diff options
author | nea <romangraef@gmail.com> | 2021-08-13 01:04:47 +0200 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2021-08-13 01:04:47 +0200 |
commit | d56753eb5de3049e094ed3a612c500c9516600c5 (patch) | |
tree | ff721f072e9ef476e668f1d4feb61befe66a0c09 /src/jsTest/kotlin | |
parent | 06d9212e5901b8b73e17bb8938b0c4542a42770b (diff) | |
download | webos-d56753eb5de3049e094ed3a612c500c9516600c5.tar.gz webos-d56753eb5de3049e094ed3a612c500c9516600c5.tar.bz2 webos-d56753eb5de3049e094ed3a612c500c9516600c5.zip |
tests
Diffstat (limited to 'src/jsTest/kotlin')
-rw-r--r-- | src/jsTest/kotlin/io/PathTest.kt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/jsTest/kotlin/io/PathTest.kt b/src/jsTest/kotlin/io/PathTest.kt new file mode 100644 index 0000000..2649a2a --- /dev/null +++ b/src/jsTest/kotlin/io/PathTest.kt @@ -0,0 +1,32 @@ +package io + +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.types.shouldBeTypeOf + +class PathTest : DescribeSpec({ + describe("Path") { + val homeDir = Path.of("/home") as Path.Absolute + it("recognize relative paths as such") { + listOf( + Path.of("a/b"), + Path.of("."), + Path.of("a", "b"), + Path.ofShell("a/b", userHome = homeDir), + Path.ofShell(".", userHome = homeDir), + Path.ofShell("a", "b", userHome = homeDir), + Path.ofShell(listOf("a", "b"), userHome = homeDir), + ).forEach { + it.shouldBeTypeOf<Path.Relative>() + } + } + it("recognize absolute paths as such") { + listOf( + Path.of("/a/b"), + Path.of("/"), + Path.ofShell("/b/c", userHome = homeDir), + ).forEach { + it.shouldBeTypeOf<Path.Absolute>() + } + } + } +}) |