blob: 016c91cc21066c9d8718aa1774a51e4fa9f4d696 (
plain)
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
33
34
35
36
37
38
39
|
# Tests for file paths
func main():
>> (/):exists()
= yes
>> (~/):exists()
= yes
>> tmpdir := (/tmp/tomo-test-path-XXXXXX):unique_directory()
>> (/tmp):subdirectories():has(tmpdir)
= yes
>> tmpfile := (tmpdir++(./one.txt))
>> tmpfile:write("Hello world")
>> tmpfile:append("!")
>> tmpfile:read()
= "Hello world!"
>> tmpdir:files():has(tmpfile)
= yes
>> tmpfile:remove()
>> tmpdir:files():has(tmpfile)
= no
>> tmpdir:remove()
>> p := (/foo/baz.x/qux.tar.gz)
>> p:base_name()
= "qux.tar.gz"
>> p:parent()
= (/foo/baz.x)
>> p:extension()
= "tar.gz"
>> p:extension(full=no)
= "gz"
>> (~/.foo):extension()
= ""
>> (~/foo):extension()
= ""
|