diff options
Diffstat (limited to 'test/suite-ev2.janet')
| -rw-r--r-- | test/suite-ev2.janet | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/suite-ev2.janet b/test/suite-ev2.janet index c94a2d86..caa323a4 100644 --- a/test/suite-ev2.janet +++ b/test/suite-ev2.janet @@ -84,4 +84,21 @@ (assert-error "cannot schedule non-new fiber" (ev/go f)) +# IO file copying +(os/mkdir "tmp") +(def f-original (file/open "tmp/out.txt" :wb)) +(xprin f-original "hello\n") +(file/flush f-original) +(ev/do-thread + # Closes a COPY of the original file, otherwise we get a user-after-close file descriptor + (:close f-original)) +(def g-original (file/open "tmp/out2.txt" :wb)) +(xprin g-original "world1\n") +(xprin f-original "world2\n") +(:close f-original) +(xprin g-original "abc\n") +(:close g-original) +(assert (deep= @"hello\nworld2\n" (slurp "tmp/out.txt")) "file threading 1") +(assert (deep= @"world1\nabc\n" (slurp "tmp/out2.txt")) "file threading 2") + (end-suite) |
