Skip to content

Commit

Permalink
Remove supportsFileHandle since they all support it
Browse files Browse the repository at this point in the history
  • Loading branch information
oldergod committed Jun 19, 2023
1 parent 60439b7 commit 6d3968a
Showing 1 changed file with 0 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1535,8 +1535,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleWriteAndRead() {
if (!supportsFileHandle()) return

val path = base / "file-handle-write-and-read"
fileSystem.openReadWrite(path).use { handle ->

Expand All @@ -1552,8 +1550,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleWriteAndOverwrite() {
if (!supportsFileHandle()) return

val path = base / "file-handle-write-and-overwrite"
fileSystem.openReadWrite(path).use { handle ->

Expand All @@ -1572,8 +1568,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleWriteBeyondEnd() {
if (!supportsFileHandle()) return

val path = base / "file-handle-write-beyond-end"
fileSystem.openReadWrite(path).use { handle ->

Expand All @@ -1589,8 +1583,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleResizeSmaller() {
if (!supportsFileHandle()) return

val path = base / "file-handle-resize-smaller"
fileSystem.openReadWrite(path).use { handle ->

Expand All @@ -1607,8 +1599,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleResizeLarger() {
if (!supportsFileHandle()) return

val path = base / "file-handle-resize-larger"
fileSystem.openReadWrite(path).use { handle ->

Expand All @@ -1626,7 +1616,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleFlush() {
if (!supportsFileHandle()) return
if (windowsLimitations) return // Open for reading and writing simultaneously.

val path = base / "file-handle-flush"
Expand All @@ -1645,7 +1634,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleLargeBufferedWriteAndRead() {
if (!supportsFileHandle()) return
if (isBrowser()) return // This test errors on browsers in CI.

val data = randomBytes(1024 * 1024 * 8)
Expand All @@ -1665,7 +1653,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleLargeArrayWriteAndRead() {
if (!supportsFileHandle()) return
if (isBrowser()) return // This test errors on browsers in CI.

val path = base / "file-handle-large-array-write-and-read"
Expand All @@ -1685,8 +1672,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleSinkPosition() {
if (!supportsFileHandle()) return

val path = base / "file-handle-sink-position"

fileSystem.openReadWrite(path).use { handle ->
Expand All @@ -1707,8 +1692,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleBufferedSinkPosition() {
if (!supportsFileHandle()) return

val path = base / "file-handle-buffered-sink-position"

fileSystem.openReadWrite(path).use { handle ->
Expand All @@ -1729,8 +1712,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleSinkReposition() {
if (!supportsFileHandle()) return

val path = base / "file-handle-sink-reposition"

fileSystem.openReadWrite(path).use { handle ->
Expand Down Expand Up @@ -1762,8 +1743,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleBufferedSinkReposition() {
if (!supportsFileHandle()) return

val path = base / "file-handle-buffered-sink-reposition"

fileSystem.openReadWrite(path).use { handle ->
Expand Down Expand Up @@ -1795,8 +1774,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleSourceHappyPath() {
if (!supportsFileHandle()) return

val path = base / "file-handle-source"
fileSystem.write(path) {
writeUtf8("abcdefghijklmnop")
Expand Down Expand Up @@ -1830,8 +1807,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleSourceReposition() {
if (!supportsFileHandle()) return

val path = base / "file-handle-source-reposition"
fileSystem.write(path) {
writeUtf8("abcdefghijklmnop")
Expand Down Expand Up @@ -1872,8 +1847,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleBufferedSourceReposition() {
if (!supportsFileHandle()) return

val path = base / "file-handle-buffered-source-reposition"
fileSystem.write(path) {
writeUtf8("abcdefghijklmnop")
Expand Down Expand Up @@ -1922,8 +1895,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun fileHandleSourceSeekBackwards() {
if (!supportsFileHandle()) return

val path = base / "file-handle-source-backwards"
fileSystem.write(path) {
writeUtf8("abcdefghijklmnop")
Expand All @@ -1949,8 +1920,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun bufferedFileHandleSourceHappyPath() {
if (!supportsFileHandle()) return

val path = base / "file-handle-source"
fileSystem.write(path) {
writeUtf8("abcdefghijklmnop")
Expand Down Expand Up @@ -1984,8 +1953,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun bufferedFileHandleSourceSeekBackwards() {
if (!supportsFileHandle()) return

val path = base / "file-handle-source-backwards"
fileSystem.write(path) {
writeUtf8("abcdefghijklmnop")
Expand All @@ -2011,8 +1978,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun openReadOnlyThrowsOnAttemptToWrite() {
if (!supportsFileHandle()) return

val path = base / "file-handle-source"
fileSystem.write(path) {
writeUtf8("abcdefghijklmnop")
Expand Down Expand Up @@ -2046,8 +2011,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun openReadOnlyFailsOnAbsentFile() {
if (!supportsFileHandle()) return

val path = base / "file-handle-source"

try {
Expand All @@ -2058,8 +2021,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun openReadWriteCreatesAbsentFile() {
if (!supportsFileHandle()) return

val path = base / "file-handle-source"

fileSystem.openReadWrite(path).use {
Expand All @@ -2069,8 +2030,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun openReadWriteCreatesAbsentFileMustCreate() {
if (!supportsFileHandle()) return

val path = base / "file-handle-source"

fileSystem.openReadWrite(path, mustCreate = true).use {
Expand All @@ -2080,7 +2039,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun openReadWriteMustCreateThrowsIfAlreadyExists() {
if (!supportsFileHandle()) return
val path = base / "file-handle-source"
path.writeUtf8("First!")

Expand All @@ -2090,8 +2048,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun openReadWriteMustExist() {
if (!supportsFileHandle()) return

val path = base / "file-handle-source"
path.writeUtf8("one")

Expand All @@ -2103,7 +2059,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun openReadWriteMustExistThrowsIfAbsent() {
if (!supportsFileHandle()) return
val path = base / "file-handle-source"

assertFailsWith<IOException> {
Expand All @@ -2112,7 +2067,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun openReadWriteThrowsIfBothMustCreateAndMustExist() {
if (!supportsFileHandle()) return
val path = base / "file-handle-source"

assertFailsWith<IllegalArgumentException> {
Expand All @@ -2121,8 +2075,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun sinkPositionFailsAfterClose() {
if (!supportsFileHandle()) return

val path = base / "sink-position-fails-after-close"

fileSystem.openReadWrite(path).use { handle ->
Expand All @@ -2142,8 +2094,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun sinkRepositionFailsAfterClose() {
if (!supportsFileHandle()) return

val path = base / "sink-reposition-fails-after-close"

fileSystem.openReadWrite(path).use { handle ->
Expand All @@ -2163,8 +2113,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun sourcePositionFailsAfterClose() {
if (!supportsFileHandle()) return

val path = base / "source-position-fails-after-close"

fileSystem.openReadWrite(path).use { handle ->
Expand All @@ -2184,8 +2132,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun sourceRepositionFailsAfterClose() {
if (!supportsFileHandle()) return

val path = base / "source-reposition-fails-after-close"

fileSystem.openReadWrite(path).use { handle ->
Expand All @@ -2205,8 +2151,6 @@ abstract class AbstractFileSystemTest(
}

@Test fun sizeFailsAfterClose() {
if (!supportsFileHandle()) return

val path = base / "size-fails-after-close"

val handle = fileSystem.openReadWrite(path)
Expand Down Expand Up @@ -2462,14 +2406,6 @@ abstract class AbstractFileSystemTest(
)
}

private fun supportsFileHandle(): Boolean {
return when (fileSystem::class.simpleName) {
"AddFileSystemNameIfNotSupportingAny",
-> false
else -> true
}
}

protected fun supportsSymlink(): Boolean {
if (fileSystem is FakeFileSystem) return fileSystem.allowSymlinks
if (windowsLimitations) return false
Expand Down

0 comments on commit 6d3968a

Please sign in to comment.