From af0a1e74577cbcb98cc22ff8aebd37f05695882a Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 9 Jan 2021 15:12:36 +0000 Subject: [PATCH] Fix DiskStoreTest and FlatFileStoreTest on Windows As we're comparing a real directory tree with Jimfs, we need to ensure the platform matches - otherwise it gets confused, and thinks \ is part of a UNIX file name. --- cache/src/test/kotlin/org/openrs2/cache/DiskStoreTest.kt | 8 ++++---- .../test/kotlin/org/openrs2/cache/FlatFileStoreTest.kt | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cache/src/test/kotlin/org/openrs2/cache/DiskStoreTest.kt b/cache/src/test/kotlin/org/openrs2/cache/DiskStoreTest.kt index 212c3209..06bb5708 100644 --- a/cache/src/test/kotlin/org/openrs2/cache/DiskStoreTest.kt +++ b/cache/src/test/kotlin/org/openrs2/cache/DiskStoreTest.kt @@ -734,8 +734,8 @@ object DiskStoreTest { } private fun writeTest(name: String, f: (Store) -> Unit) { - Jimfs.newFileSystem(Configuration.unix()).use { fs -> - val actual = fs.getPath("/cache") + Jimfs.newFileSystem(Configuration.forCurrentPlatform()).use { fs -> + val actual = fs.rootDirectories.first().resolve("cache") DiskStore.create(actual).use { store -> f(store) } @@ -746,8 +746,8 @@ object DiskStoreTest { } private fun overwriteTest(src: String, name: String, f: (Store) -> Unit) { - Jimfs.newFileSystem(Configuration.unix()).use { fs -> - val actual = fs.getPath("/cache") + Jimfs.newFileSystem(Configuration.forCurrentPlatform()).use { fs -> + val actual = fs.rootDirectories.first().resolve("cache") ROOT.resolve(src).recursiveCopy(actual) DiskStore.open(actual).use { store -> diff --git a/cache/src/test/kotlin/org/openrs2/cache/FlatFileStoreTest.kt b/cache/src/test/kotlin/org/openrs2/cache/FlatFileStoreTest.kt index 1a2e5024..f0b83cd7 100644 --- a/cache/src/test/kotlin/org/openrs2/cache/FlatFileStoreTest.kt +++ b/cache/src/test/kotlin/org/openrs2/cache/FlatFileStoreTest.kt @@ -250,8 +250,8 @@ object FlatFileStoreTest { } private fun writeTest(name: String, f: (Store) -> Unit) { - Jimfs.newFileSystem(Configuration.unix()).use { fs -> - val actual = fs.getPath("/cache") + Jimfs.newFileSystem(Configuration.forCurrentPlatform()).use { fs -> + val actual = fs.rootDirectories.first().resolve("cache") FlatFileStore.create(actual).use { store -> f(store) } @@ -262,8 +262,8 @@ object FlatFileStoreTest { } private fun overwriteTest(src: String, name: String, f: (Store) -> Unit) { - Jimfs.newFileSystem(Configuration.unix()).use { fs -> - val actual = fs.getPath("/cache") + Jimfs.newFileSystem(Configuration.forCurrentPlatform()).use { fs -> + val actual = fs.rootDirectories.first().resolve("cache") ROOT.resolve(src).recursiveCopy(actual) FlatFileStore.open(actual).use { store ->