mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 19:19:53 +00:00
add test for calling ev/read on normal fd
The test is almost identical to the os/open + :write test. The only difference is the content is read back in with :read, not slurp
This commit is contained in:
parent
938c5013c9
commit
8d8a6534e3
@ -116,6 +116,19 @@
|
|||||||
(assert (= "123\n456\n" (string (slurp "unique.txt"))) "File writing 4.2")
|
(assert (= "123\n456\n" (string (slurp "unique.txt"))) "File writing 4.2")
|
||||||
(os/rm "unique.txt"))
|
(os/rm "unique.txt"))
|
||||||
|
|
||||||
|
# Test that the stream created by os/open can be read from
|
||||||
|
(assert-no-error "File reading 1.1"
|
||||||
|
(def outstream (os/open "unique.txt" :wct))
|
||||||
|
(defer (:close outstream)
|
||||||
|
(:write outstream "123\n")
|
||||||
|
(:write outstream "456\n"))
|
||||||
|
|
||||||
|
(def outstream (os/open "unique.txt" :r))
|
||||||
|
(defer (:close outstream)
|
||||||
|
(assert (= "123\n456\n" (string (:read outstream :all))) "File reading 1.2"))
|
||||||
|
(os/rm "unique.txt"))
|
||||||
|
|
||||||
|
|
||||||
# ev/gather
|
# ev/gather
|
||||||
|
|
||||||
(assert (deep= @[1 2 3] (ev/gather 1 2 3)) "ev/gather 1")
|
(assert (deep= @[1 2 3] (ev/gather 1 2 3)) "ev/gather 1")
|
||||||
|
Loading…
Reference in New Issue
Block a user