factor/extra/io/pipes/pipes-tests.factor

27 lines
681 B
Factor
Raw Normal View History

2008-05-05 04:15:24 -04:00
USING: io io.pipes io.streams.string io.encodings.utf8
io.streams.duplex io.encodings namespaces continuations
tools.test kernel ;
IN: io.pipes.tests
[ "Hello" ] [
2008-05-05 04:15:24 -04:00
utf8 <pipe> [
"Hello" print flush
readln
] with-stream
] unit-test
2008-05-05 04:15:24 -04:00
[ { } ] [ { } with-pipeline ] unit-test
[ { f } ] [ { [ f ] } with-pipeline ] unit-test
[ { "Hello" } ] [
"Hello" [
{ [ input-stream [ utf8 <decoder> ] change readln ] } with-pipeline
] with-string-reader
] unit-test
[ { f "Hello" } ] [
{
2008-05-05 04:15:24 -04:00
[ output-stream [ utf8 <encoder> ] change "Hello" print flush f ]
[ input-stream [ utf8 <decoder> ] change readln ]
} with-pipeline
] unit-test