io.streams.string: cleanup tests.
parent
e0e88895a1
commit
b039b6a542
|
@ -6,70 +6,53 @@ IN: io.streams.string.tests
|
||||||
|
|
||||||
[ "line 1" CHAR: l ]
|
[ "line 1" CHAR: l ]
|
||||||
[
|
[
|
||||||
"line 1\nline 2\nline 3" <string-reader>
|
"line 1\nline 2\nline 3" [ readln read1 ] with-string-reader
|
||||||
dup stream-readln swap stream-read1
|
|
||||||
]
|
]
|
||||||
unit-test
|
unit-test
|
||||||
|
|
||||||
{ { "line 1" "line 2" "line 3" } } [
|
{ { "line 1" "line 2" "line 3" } } [
|
||||||
"line 1\nline 2\nline 3" <string-reader> stream-lines
|
"line 1\nline 2\nline 3" [ lines ] with-string-reader
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ { "" "foo" "bar" "baz" } } [
|
{ { "" "foo" "bar" "baz" } } [
|
||||||
"\rfoo\r\nbar\rbaz\n" <string-reader> stream-lines
|
"\rfoo\r\nbar\rbaz\n" [ lines ] with-string-reader
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ f ]
|
[ f ] [ "" [ readln ] with-string-reader ] unit-test
|
||||||
[ "" <string-reader> stream-readln ]
|
|
||||||
unit-test
|
|
||||||
|
|
||||||
[ "xyzzy" ] [ [ "xyzzy" write ] with-string-writer ] unit-test
|
[ "xyzzy" ] [ [ "xyzzy" write ] with-string-writer ] unit-test
|
||||||
|
|
||||||
[ "a" ] [ 1 "abc" <string-reader> stream-read ] unit-test
|
[ "a" ] [ "abc" [ 1 read ] with-string-reader ] unit-test
|
||||||
[ "ab" ] [ 2 "abc" <string-reader> stream-read ] unit-test
|
[ "ab" ] [ "abc" [ 2 read ] with-string-reader ] unit-test
|
||||||
[ "abc" ] [ 3 "abc" <string-reader> stream-read ] unit-test
|
[ "abc" ] [ "abc" [ 3 read ] with-string-reader ] unit-test
|
||||||
[ "abc" ] [ 4 "abc" <string-reader> stream-read ] unit-test
|
[ "abc" ] [ "abc" [ 4 read ] with-string-reader ] unit-test
|
||||||
[ "abc" f ] [
|
[ "abc" f ] [ "abc" [ 3 read read1 ] with-string-reader ] unit-test
|
||||||
3 "abc" <string-reader> [ stream-read ] keep stream-read1
|
|
||||||
] unit-test
|
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{ "It seems " CHAR: J }
|
||||||
{ "It seems " CHAR: J }
|
{ "obs has lost h" CHAR: i }
|
||||||
{ "obs has lost h" CHAR: i }
|
{ "s grasp on reality again.\n" f }
|
||||||
{ "s grasp on reality again.\n" f }
|
|
||||||
}
|
|
||||||
] [
|
] [
|
||||||
[
|
"It seems Jobs has lost his grasp on reality again.\n" [
|
||||||
"It seems Jobs has lost his grasp on reality again.\n"
|
"J" read-until 2array
|
||||||
<string-reader> [
|
"i" read-until 2array
|
||||||
"J" read-until 2array ,
|
"X" read-until 2array
|
||||||
"i" read-until 2array ,
|
] with-string-reader
|
||||||
"X" read-until 2array ,
|
|
||||||
] with-input-stream
|
|
||||||
] { } make
|
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ "" CHAR: \r } [
|
{ "" CHAR: \r } [ "\r\n" [ "\r" read-until ] with-string-reader ] unit-test
|
||||||
"\r\n" <string-reader> [ "\r" read-until ] with-input-stream
|
{ f f } [ "" [ "\r" read-until ] with-string-reader ] unit-test
|
||||||
|
|
||||||
|
[ "hello" "hi" ] [
|
||||||
|
"hello\nhi" [ readln 2 read ] with-string-reader
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "hello" "hi" ] [
|
[ "hello" "hi" ] [
|
||||||
"hello\nhi" <string-reader>
|
"hello\r\nhi" [ readln 2 read ] with-string-reader
|
||||||
dup stream-readln
|
|
||||||
2 rot stream-read
|
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "hello" "hi" ] [
|
[ "hello" "hi" ] [
|
||||||
"hello\r\nhi" <string-reader>
|
"hello\rhi" [ readln 2 read ] with-string-reader
|
||||||
dup stream-readln
|
|
||||||
2 rot stream-read
|
|
||||||
] unit-test
|
|
||||||
|
|
||||||
[ "hello" "hi" ] [
|
|
||||||
"hello\rhi" <string-reader>
|
|
||||||
dup stream-readln
|
|
||||||
2 rot stream-read
|
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! Issue #70 github
|
! Issue #70 github
|
||||||
|
|
Loading…
Reference in New Issue