diff options
Diffstat (limited to 'libs/test-utils/src/main/java/org')
| -rw-r--r-- | libs/test-utils/src/main/java/org/the_jk/cleversync/TreeAbstractTest.kt | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/libs/test-utils/src/main/java/org/the_jk/cleversync/TreeAbstractTest.kt b/libs/test-utils/src/main/java/org/the_jk/cleversync/TreeAbstractTest.kt index a82001c..0a0b32d 100644 --- a/libs/test-utils/src/main/java/org/the_jk/cleversync/TreeAbstractTest.kt +++ b/libs/test-utils/src/main/java/org/the_jk/cleversync/TreeAbstractTest.kt @@ -439,6 +439,57 @@ abstract class TreeAbstractTest { assertThat(content.files[0].name).isEqualTo(file.name) } + @Test + open fun openDirInDir() { + val foo = tree.createDirectory("foo") + val bar = foo.createDirectory("bar") + val fooBar = tree.openDir("foo/bar") + assertThat(fooBar).isEqualTo(bar) + } + + @Test + open fun openFileInDir() { + val foo = tree.createDirectory("foo") + val bar = foo.createFile("bar") + bar.write().use { it.write(1) } + val fooBar = tree.openFile("foo/bar") + assertThat(fooBar).isEqualTo(bar) + } + + @Test + open fun createDirInDir() { + val foo = tree.createDirectory("foo") + val fooBar = tree.createDirectory("foo/bar") + val bar = foo.openDir("bar") + assertThat(bar).isEqualTo(fooBar) + } + + @Test + open fun createFileInDir() { + val foo = tree.createDirectory("foo") + val fooBar = tree.createFile("foo/bar") + fooBar.write().use { it.write(1) } + val bar = foo.openFile("bar") + assertThat(bar).isEqualTo(fooBar) + } + + @Test + open fun removeDirInDir() { + val foo = tree.createDirectory("foo") + foo.createDirectory("bar") + assertThat(tree.removeDirectory("foo/bar")).isTrue() + assertThat(foo.list().directories).isEmpty() + } + + @Test + open fun removeFileInDir() { + val foo = tree.createDirectory("foo") + val bar = foo.createFile("bar") + bar.write().use { it.write(1) } + assertThat(tree.removeFile("foo/bar")).isTrue() + assertThat(foo.list().files).isEmpty() + } + protected abstract fun supportSymlinks(): Boolean protected abstract fun idle() |
