1 USING: accessors io io.encodings io.encodings.ascii
2 io.encodings.utf8 io.files io.streams.byte-array
3 io.streams.string kernel namespaces tools.test ;
7 [ "vocab:io/test/empty-file.txt" ascii file-lines ]
10 : lines-test ( file encoding -- line1 line2 )
11 [ readln readln ] with-file-reader ;
15 "This is another line."
17 "vocab:io/test/windows-eol.txt"
23 "This is another line."
25 "vocab:io/test/mac-os-eol.txt"
31 "This is another line."
33 "vocab:io/test/unix-eol.txt"
40 "Hello world\r\n1234" <string-reader>
41 dup stream-readln drop
48 "Hello world\r\n1234" <string-reader>
49 dup stream-readln drop
50 4 swap stream-read-partial
56 "Hello world\r\n1234" <string-reader>
57 dup stream-readln drop
63 input-stream get code>>
65 input-stream get code>>
71 output-stream get code>>
73 output-stream get code>>
74 ] with-byte-writer drop
78 "vocab:io/test/mac-os-eol.txt"
79 ascii [ 10 peek 10 peek = ] with-file-reader
83 "vocab:io/test/mac-os-eol.txt"
84 ascii [ peek1 peek1 = ] with-file-reader