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 [ "resource:core/io/test/empty-file.txt" ascii <file-reader> lines ]
10 : lines-test ( stream -- line1 line2 )
11 [ readln readln ] with-input-stream ;
15 "This is another line."
17 "resource:core/io/test/windows-eol.txt"
18 ascii <file-reader> lines-test
23 "This is another line."
25 "resource:core/io/test/mac-os-eol.txt"
26 ascii <file-reader> lines-test
31 "This is another line."
33 "resource:core/io/test/unix-eol.txt"
34 ascii <file-reader> lines-test
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