mirror of
https://github.com/janet-lang/janet
synced 2025-10-22 03:07:41 +00:00
@@ -102,6 +102,20 @@
|
||||
(os/execute [janet "-e" `(repeat 20 (print :hello))`] :p {:out f})
|
||||
(file/flush f)))
|
||||
|
||||
# each-line iterator
|
||||
|
||||
(assert-no-error "file/lines iterator"
|
||||
(def outstream (os/open "unique.txt" :wct))
|
||||
(def buf1 "123\n456\n")
|
||||
(defer (:close outstream)
|
||||
(:write outstream buf1))
|
||||
(var buf2 "")
|
||||
(with [f (file/open "unique.txt" :r)]
|
||||
(each line (file/lines f)
|
||||
(set buf2 (string buf2 line))))
|
||||
(assert (= buf1 buf2) "file/lines iterator")
|
||||
(os/rm "unique.txt"))
|
||||
|
||||
# Issue #593
|
||||
(assert-no-error "file writing 3"
|
||||
(def outfile (file/open "unique.txt" :w))
|
||||
|
Reference in New Issue
Block a user