aboutsummaryrefslogtreecommitdiff
path: root/test/paths.tm
blob: bc85c31af7f8709c5441353054d0953c15ec2bc1 (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
# 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()