1 USING: io.files io.streams.string io io.streams.byte-array
2 tools.test kernel io.encodings.ascii io.encodings.utf8
3 namespaces accessors io.encodings ;
4 IN: io.streams.encodings.tests
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