From 711c23d847b7075d0dd934024825270c2eaf249f Mon Sep 17 00:00:00 2001 From: Benoit Quenaudon Date: Mon, 19 Jun 2023 19:45:08 +0200 Subject: [PATCH] Remove maybe obsolete check? --- .../kotlin/okio/AbstractFileSystemTest.kt | 106 +++++++++++------- 1 file changed, 66 insertions(+), 40 deletions(-) diff --git a/okio-testing-support/src/commonMain/kotlin/okio/AbstractFileSystemTest.kt b/okio-testing-support/src/commonMain/kotlin/okio/AbstractFileSystemTest.kt index 9ed87c3b64..bb65a3a2e8 100644 --- a/okio-testing-support/src/commonMain/kotlin/okio/AbstractFileSystemTest.kt +++ b/okio-testing-support/src/commonMain/kotlin/okio/AbstractFileSystemTest.kt @@ -1113,15 +1113,8 @@ abstract class AbstractFileSystemTest( @Test fun deleteFailsOnNoSuchFileIfMustExist() { val path = base / "no-such-file" - // TODO(jwilson): fix Windows to throw FileNotFoundException on deleting an absent file. - if (windowsLimitations) { - assertFailsWith { - fileSystem.delete(path, mustExist = true) - } - } else { - assertFailsWith { - fileSystem.delete(path, mustExist = true) - } + assertFailsWith { + fileSystem.delete(path, mustExist = true) } } @@ -1528,7 +1521,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleWriteAndRead() { + @Test + fun fileHandleWriteAndRead() { if (!supportsFileHandle()) return val path = base / "file-handle-write-and-read" @@ -1545,7 +1539,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleWriteAndOverwrite() { + @Test + fun fileHandleWriteAndOverwrite() { if (!supportsFileHandle()) return val path = base / "file-handle-write-and-overwrite" @@ -1565,7 +1560,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleWriteBeyondEnd() { + @Test + fun fileHandleWriteBeyondEnd() { if (!supportsFileHandle()) return val path = base / "file-handle-write-beyond-end" @@ -1582,7 +1578,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleResizeSmaller() { + @Test + fun fileHandleResizeSmaller() { if (!supportsFileHandle()) return val path = base / "file-handle-resize-smaller" @@ -1600,7 +1597,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleResizeLarger() { + @Test + fun fileHandleResizeLarger() { if (!supportsFileHandle()) return val path = base / "file-handle-resize-larger" @@ -1619,7 +1617,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleFlush() { + @Test + fun fileHandleFlush() { if (!supportsFileHandle()) return if (windowsLimitations) return // Open for reading and writing simultaneously. @@ -1638,7 +1637,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleLargeBufferedWriteAndRead() { + @Test + fun fileHandleLargeBufferedWriteAndRead() { if (!supportsFileHandle()) return if (isBrowser()) return // This test errors on browsers in CI. @@ -1658,7 +1658,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleLargeArrayWriteAndRead() { + @Test + fun fileHandleLargeArrayWriteAndRead() { if (!supportsFileHandle()) return if (isBrowser()) return // This test errors on browsers in CI. @@ -1678,7 +1679,8 @@ abstract class AbstractFileSystemTest( assertEquals(writtenBytes, readBytes) } - @Test fun fileHandleSinkPosition() { + @Test + fun fileHandleSinkPosition() { if (!supportsFileHandle()) return val path = base / "file-handle-sink-position" @@ -1700,7 +1702,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleBufferedSinkPosition() { + @Test + fun fileHandleBufferedSinkPosition() { if (!supportsFileHandle()) return val path = base / "file-handle-buffered-sink-position" @@ -1722,7 +1725,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleSinkReposition() { + @Test + fun fileHandleSinkReposition() { if (!supportsFileHandle()) return val path = base / "file-handle-sink-reposition" @@ -1755,7 +1759,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleBufferedSinkReposition() { + @Test + fun fileHandleBufferedSinkReposition() { if (!supportsFileHandle()) return val path = base / "file-handle-buffered-sink-reposition" @@ -1788,7 +1793,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleSourceHappyPath() { + @Test + fun fileHandleSourceHappyPath() { if (!supportsFileHandle()) return val path = base / "file-handle-source" @@ -1823,7 +1829,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleSourceReposition() { + @Test + fun fileHandleSourceReposition() { if (!supportsFileHandle()) return val path = base / "file-handle-source-reposition" @@ -1865,7 +1872,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleBufferedSourceReposition() { + @Test + fun fileHandleBufferedSourceReposition() { if (!supportsFileHandle()) return val path = base / "file-handle-buffered-source-reposition" @@ -1915,7 +1923,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun fileHandleSourceSeekBackwards() { + @Test + fun fileHandleSourceSeekBackwards() { if (!supportsFileHandle()) return val path = base / "file-handle-source-backwards" @@ -1942,7 +1951,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun bufferedFileHandleSourceHappyPath() { + @Test + fun bufferedFileHandleSourceHappyPath() { if (!supportsFileHandle()) return val path = base / "file-handle-source" @@ -1977,7 +1987,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun bufferedFileHandleSourceSeekBackwards() { + @Test + fun bufferedFileHandleSourceSeekBackwards() { if (!supportsFileHandle()) return val path = base / "file-handle-source-backwards" @@ -2004,7 +2015,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun openReadOnlyThrowsOnAttemptToWrite() { + @Test + fun openReadOnlyThrowsOnAttemptToWrite() { if (!supportsFileHandle()) return val path = base / "file-handle-source" @@ -2039,7 +2051,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun openReadOnlyFailsOnAbsentFile() { + @Test + fun openReadOnlyFailsOnAbsentFile() { if (!supportsFileHandle()) return val path = base / "file-handle-source" @@ -2051,7 +2064,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun openReadWriteCreatesAbsentFile() { + @Test + fun openReadWriteCreatesAbsentFile() { if (!supportsFileHandle()) return val path = base / "file-handle-source" @@ -2062,7 +2076,8 @@ abstract class AbstractFileSystemTest( assertEquals("", path.readUtf8()) } - @Test fun openReadWriteCreatesAbsentFileMustCreate() { + @Test + fun openReadWriteCreatesAbsentFileMustCreate() { if (!supportsFileHandle()) return val path = base / "file-handle-source" @@ -2073,7 +2088,8 @@ abstract class AbstractFileSystemTest( assertEquals("", path.readUtf8()) } - @Test fun openReadWriteMustCreateThrowsIfAlreadyExists() { + @Test + fun openReadWriteMustCreateThrowsIfAlreadyExists() { if (!supportsFileHandle()) return val path = base / "file-handle-source" path.writeUtf8("First!") @@ -2083,7 +2099,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun openReadWriteMustExist() { + @Test + fun openReadWriteMustExist() { if (!supportsFileHandle()) return val path = base / "file-handle-source" @@ -2096,7 +2113,8 @@ abstract class AbstractFileSystemTest( assertEquals("one two", path.readUtf8()) } - @Test fun openReadWriteMustExistThrowsIfAbsent() { + @Test + fun openReadWriteMustExistThrowsIfAbsent() { if (!supportsFileHandle()) return val path = base / "file-handle-source" @@ -2105,7 +2123,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun openReadWriteThrowsIfBothMustCreateAndMustExist() { + @Test + fun openReadWriteThrowsIfBothMustCreateAndMustExist() { if (!supportsFileHandle()) return val path = base / "file-handle-source" @@ -2114,7 +2133,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun sinkPositionFailsAfterClose() { + @Test + fun sinkPositionFailsAfterClose() { if (!supportsFileHandle()) return val path = base / "sink-position-fails-after-close" @@ -2135,7 +2155,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun sinkRepositionFailsAfterClose() { + @Test + fun sinkRepositionFailsAfterClose() { if (!supportsFileHandle()) return val path = base / "sink-reposition-fails-after-close" @@ -2156,7 +2177,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun sourcePositionFailsAfterClose() { + @Test + fun sourcePositionFailsAfterClose() { if (!supportsFileHandle()) return val path = base / "source-position-fails-after-close" @@ -2177,7 +2199,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun sourceRepositionFailsAfterClose() { + @Test + fun sourceRepositionFailsAfterClose() { if (!supportsFileHandle()) return val path = base / "source-reposition-fails-after-close" @@ -2198,7 +2221,8 @@ abstract class AbstractFileSystemTest( } } - @Test fun sizeFailsAfterClose() { + @Test + fun sizeFailsAfterClose() { if (!supportsFileHandle()) return val path = base / "size-fails-after-close" @@ -2460,6 +2484,7 @@ abstract class AbstractFileSystemTest( return when (fileSystem::class.simpleName) { "AddFileSystemNameIfNotSupportingAny", -> false + else -> true } } @@ -2471,6 +2496,7 @@ abstract class AbstractFileSystemTest( "JvmSystemFileSystem", "NioFileSystemWrappingFileSystem", -> false + else -> true } }