aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/paths.tm19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/paths.tm b/test/paths.tm
index 996b6dde..946526bb 100644
--- a/test/paths.tm
+++ b/test/paths.tm
@@ -23,12 +23,27 @@ func main():
>> tmpfile:write("Hello world")
>> tmpfile:append("!")
>> tmpfile:read()
- = "Hello world!"
+ = "Hello world!"?
>> tmpfile:read_bytes()
- = [72[B], 101[B], 108[B], 108[B], 111[B], 32[B], 119[B], 111[B], 114[B], 108[B], 100[B], 33[B]]
+ = [72[B], 101[B], 108[B], 108[B], 111[B], 32[B], 119[B], 111[B], 114[B], 108[B], 100[B], 33[B]]?
>> tmpdir:files():has(tmpfile)
= yes
+ if tmp_lines := tmpfile:by_line():
+ >> [line for line in tmp_lines]
+ = ["Hello world!"]
+ else:
+ fail("Couldn't read lines in $tmpfile")
+
+ >> (./does-not-exist.xxx):read()
+ = !Text
+ >> (./does-not-exist.xxx):read_bytes()
+ = ![Byte]
+ if lines := (./does-not-exist.xxx):by_line():
+ fail("I could read lines in a nonexistent file")
+ else:
+ pass
+
>> tmpfile:remove()
>> tmpdir:files():has(tmpfile)