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
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>()
}
}
}
})
|