1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package io
import io.kotest.assertions.assertSoftly
import io.kotest.core.spec.style.FunSpec
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 {
assertSoftly(it) { shouldBeTypeOf<Path.Relative>() }
}
}
test("recognize absolute paths as such") {
listOf(
Path.of("/a/b"),
Path.of("/"),
Path.ofShell("/b/c", userHome = homeDir),
).forEach {
assertSoftly(it) { shouldBeTypeOf<Path.Absolute>() }
}
}
})
|