1 USING: io.streams.string io kernel arrays namespaces tools.test ;
2 IN: io.streams.string.tests
6 "line 1\nline 2\nline 3" <string-reader>
7 dup stream-readln swap stream-read1
12 [ "" <string-reader> stream-readln ]
15 [ "xyzzy" ] [ [ "xyzzy" write ] with-string-writer ] unit-test
17 [ "a" ] [ 1 SBUF" cba" stream-read ] unit-test
18 [ "ab" ] [ 2 SBUF" cba" stream-read ] unit-test
19 [ "abc" ] [ 3 SBUF" cba" stream-read ] unit-test
20 [ "abc" ] [ 4 SBUF" cba" stream-read ] unit-test
22 3 SBUF" cba" [ stream-read ] keep stream-read1
27 { "It seems " CHAR: J }
28 { "obs has lost h" CHAR: i }
29 { "s grasp on reality again.\n" f }
33 "It seems Jobs has lost his grasp on reality again.\n"
35 "J" read-until 2array ,
36 "i" read-until 2array ,
37 "X" read-until 2array ,
43 "hello\nhi" <string-reader>
49 "hello\r\nhi" <string-reader>
55 "hello\rhi" <string-reader>