From 6d3968af4f4faa01e93a7c692df6e349ee3e2d96 Mon Sep 17 00:00:00 2001 From: Benoit Quenaudon Date: Mon, 19 Jun 2023 12:36:38 +0200 Subject: [PATCH] Remove supportsFileHandle since they all support it --- .../kotlin/okio/AbstractFileSystemTest.kt | 64 ------------------- 1 file changed, 64 deletions(-) diff --git a/okio-testing-support/src/commonMain/kotlin/okio/AbstractFileSystemTest.kt b/okio-testing-support/src/commonMain/kotlin/okio/AbstractFileSystemTest.kt index 2609852811..0ec8bae427 100644 --- a/okio-testing-support/src/commonMain/kotlin/okio/AbstractFileSystemTest.kt +++ b/okio-testing-support/src/commonMain/kotlin/okio/AbstractFileSystemTest.kt @@ -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 -> @@ -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 -> @@ -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 -> @@ -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 -> @@ -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 -> @@ -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" @@ -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) @@ -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" @@ -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 -> @@ -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 -> @@ -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 -> @@ -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 -> @@ -1795,8 +1774,6 @@ abstract class AbstractFileSystemTest( } @Test fun fileHandleSourceHappyPath() { - if (!supportsFileHandle()) return - val path = base / "file-handle-source" fileSystem.write(path) { writeUtf8("abcdefghijklmnop") @@ -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") @@ -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") @@ -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") @@ -1949,8 +1920,6 @@ abstract class AbstractFileSystemTest( } @Test fun bufferedFileHandleSourceHappyPath() { - if (!supportsFileHandle()) return - val path = base / "file-handle-source" fileSystem.write(path) { writeUtf8("abcdefghijklmnop") @@ -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") @@ -2011,8 +1978,6 @@ abstract class AbstractFileSystemTest( } @Test fun openReadOnlyThrowsOnAttemptToWrite() { - if (!supportsFileHandle()) return - val path = base / "file-handle-source" fileSystem.write(path) { writeUtf8("abcdefghijklmnop") @@ -2046,8 +2011,6 @@ abstract class AbstractFileSystemTest( } @Test fun openReadOnlyFailsOnAbsentFile() { - if (!supportsFileHandle()) return - val path = base / "file-handle-source" try { @@ -2058,8 +2021,6 @@ abstract class AbstractFileSystemTest( } @Test fun openReadWriteCreatesAbsentFile() { - if (!supportsFileHandle()) return - val path = base / "file-handle-source" fileSystem.openReadWrite(path).use { @@ -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 { @@ -2080,7 +2039,6 @@ abstract class AbstractFileSystemTest( } @Test fun openReadWriteMustCreateThrowsIfAlreadyExists() { - if (!supportsFileHandle()) return val path = base / "file-handle-source" path.writeUtf8("First!") @@ -2090,8 +2048,6 @@ abstract class AbstractFileSystemTest( } @Test fun openReadWriteMustExist() { - if (!supportsFileHandle()) return - val path = base / "file-handle-source" path.writeUtf8("one") @@ -2103,7 +2059,6 @@ abstract class AbstractFileSystemTest( } @Test fun openReadWriteMustExistThrowsIfAbsent() { - if (!supportsFileHandle()) return val path = base / "file-handle-source" assertFailsWith { @@ -2112,7 +2067,6 @@ abstract class AbstractFileSystemTest( } @Test fun openReadWriteThrowsIfBothMustCreateAndMustExist() { - if (!supportsFileHandle()) return val path = base / "file-handle-source" assertFailsWith { @@ -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 -> @@ -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 -> @@ -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 -> @@ -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 -> @@ -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) @@ -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