summaryrefslogtreecommitdiff
path: root/src/jsTest/kotlin/io/PathTest.kt
diff options
context:
space:
mode:
authorromangraef <romangraef@users.noreply.github.com>2021-08-12 23:37:33 +0000
committerromangraef <romangraef@users.noreply.github.com>2021-08-12 23:37:33 +0000
commitbb618136911c338a926496dfb6971aa86f7d87c2 (patch)
treea57c587eca5bde9ea02996a002d9eaf3c269a3cb /src/jsTest/kotlin/io/PathTest.kt
parent09dbaa8df9aec51cf41694266574ad330963dfbe (diff)
downloadwebos-bb618136911c338a926496dfb6971aa86f7d87c2.tar.gz
webos-bb618136911c338a926496dfb6971aa86f7d87c2.tar.bz2
webos-bb618136911c338a926496dfb6971aa86f7d87c2.zip
Automated deployment: Thu Aug 12 23:37:33 UTC 2021 b6187f47b9e969ce311de73de1c6b32d970fd69f
Diffstat (limited to 'src/jsTest/kotlin/io/PathTest.kt')
-rw-r--r--src/jsTest/kotlin/io/PathTest.kt31
1 files changed, 31 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..73667a6
--- /dev/null
+++ b/src/jsTest/kotlin/io/PathTest.kt
@@ -0,0 +1,31 @@
+package io
+
+import io.kotest.core.spec.style.FunSpec
+import io.kotest.matchers.booleans.shouldBeFalse
+import io.kotest.matchers.types.shouldBeTypeOf
+
+class PathTest : FunSpec({
+ val homeDir = Path.of("/home") as Path.Absolute
+ test("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>()
+ }
+ }
+ test("recognize absolute paths as such") {
+ listOf(
+ Path.of("/a/b"),
+ Path.of("/"),
+ Path.ofShell("/b/c", userHome = homeDir),
+ ).forEach {
+ it.shouldBeTypeOf<Path.Absolute>()
+ }
+ }
+})