1 USING: io.streams.string io kernel arrays namespaces make
3 IN: io.streams.string.tests
7 "line 1\nline 2\nline 3" <string-reader>
8 dup stream-readln swap stream-read1
13 [ "" <string-reader> stream-readln ]
16 [ "xyzzy" ] [ [ "xyzzy" write ] with-string-writer ] unit-test
18 [ "a" ] [ 1 SBUF" cba" stream-read ] unit-test
19 [ "ab" ] [ 2 SBUF" cba" stream-read ] unit-test
20 [ "abc" ] [ 3 SBUF" cba" stream-read ] unit-test
21 [ "abc" ] [ 4 SBUF" cba" stream-read ] unit-test
23 3 SBUF" cba" [ stream-read ] keep stream-read1
28 { "It seems " CHAR: J }
29 { "obs has lost h" CHAR: i }
30 { "s grasp on reality again.\n" f }
34 "It seems Jobs has lost his grasp on reality again.\n"
36 "J" read-until 2array ,
37 "i" read-until 2array ,
38 "X" read-until 2array ,
44 "hello\nhi" <string-reader>
50 "hello\r\nhi" <string-reader>
56 "hello\rhi" <string-reader>