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.
pull/132/head
Graham 3 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) {
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 ->

@ -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 ->

Loading…
Cancel
Save