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.
Graham 4 years ago
parent 43cf436c22
commit af0a1e7457
  1. 8
      cache/src/test/kotlin/org/openrs2/cache/DiskStoreTest.kt
  2. 8
      cache/src/test/kotlin/org/openrs2/cache/FlatFileStoreTest.kt

@ -734,8 +734,8 @@ object DiskStoreTest {
} }
private fun writeTest(name: String, f: (Store) -> Unit) { private fun writeTest(name: String, f: (Store) -> Unit) {
Jimfs.newFileSystem(Configuration.unix()).use { fs -> Jimfs.newFileSystem(Configuration.forCurrentPlatform()).use { fs ->
val actual = fs.getPath("/cache") val actual = fs.rootDirectories.first().resolve("cache")
DiskStore.create(actual).use { store -> DiskStore.create(actual).use { store ->
f(store) f(store)
} }
@ -746,8 +746,8 @@ object DiskStoreTest {
} }
private fun overwriteTest(src: String, name: String, f: (Store) -> Unit) { private fun overwriteTest(src: String, name: String, f: (Store) -> Unit) {
Jimfs.newFileSystem(Configuration.unix()).use { fs -> Jimfs.newFileSystem(Configuration.forCurrentPlatform()).use { fs ->
val actual = fs.getPath("/cache") val actual = fs.rootDirectories.first().resolve("cache")
ROOT.resolve(src).recursiveCopy(actual) ROOT.resolve(src).recursiveCopy(actual)
DiskStore.open(actual).use { store -> DiskStore.open(actual).use { store ->

@ -250,8 +250,8 @@ object FlatFileStoreTest {
} }
private fun writeTest(name: String, f: (Store) -> Unit) { private fun writeTest(name: String, f: (Store) -> Unit) {
Jimfs.newFileSystem(Configuration.unix()).use { fs -> Jimfs.newFileSystem(Configuration.forCurrentPlatform()).use { fs ->
val actual = fs.getPath("/cache") val actual = fs.rootDirectories.first().resolve("cache")
FlatFileStore.create(actual).use { store -> FlatFileStore.create(actual).use { store ->
f(store) f(store)
} }
@ -262,8 +262,8 @@ object FlatFileStoreTest {
} }
private fun overwriteTest(src: String, name: String, f: (Store) -> Unit) { private fun overwriteTest(src: String, name: String, f: (Store) -> Unit) {
Jimfs.newFileSystem(Configuration.unix()).use { fs -> Jimfs.newFileSystem(Configuration.forCurrentPlatform()).use { fs ->
val actual = fs.getPath("/cache") val actual = fs.rootDirectories.first().resolve("cache")
ROOT.resolve(src).recursiveCopy(actual) ROOT.resolve(src).recursiveCopy(actual)
FlatFileStore.open(actual).use { store -> FlatFileStore.open(actual).use { store ->

Loading…
Cancel
Save