2008-05-05 04:15:24 -04:00
|
|
|
USING: io io.pipes io.streams.string io.encodings.utf8
|
2010-07-30 15:58:33 -04:00
|
|
|
io.encodings.binary io.streams.duplex io.encodings io.timeouts
|
|
|
|
namespaces continuations tools.test kernel calendar destructors
|
|
|
|
accessors debugger math sequences ;
|
2008-05-05 03:19:25 -04:00
|
|
|
IN: io.pipes.tests
|
|
|
|
|
|
|
|
[ "Hello" ] [
|
2008-05-05 04:15:24 -04:00
|
|
|
utf8 <pipe> [
|
|
|
|
"Hello" print flush
|
|
|
|
readln
|
|
|
|
] with-stream
|
2008-05-05 03:19:25 -04:00
|
|
|
] unit-test
|
|
|
|
|
2008-05-05 20:12:22 -04:00
|
|
|
[ { } ] [ { } run-pipeline ] unit-test
|
|
|
|
[ { f } ] [ { [ f ] } run-pipeline ] unit-test
|
2008-05-05 04:15:24 -04:00
|
|
|
[ { "Hello" } ] [
|
|
|
|
"Hello" [
|
2008-05-06 03:10:17 -04:00
|
|
|
{ [ input-stream [ utf8 <decoder> ] change readln ] } run-pipeline
|
2008-05-05 04:15:24 -04:00
|
|
|
] with-string-reader
|
|
|
|
] unit-test
|
2008-05-05 03:19:25 -04:00
|
|
|
|
|
|
|
[ { 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 ]
|
2008-05-05 20:12:22 -04:00
|
|
|
} run-pipeline
|
2008-05-05 03:19:25 -04:00
|
|
|
] unit-test
|
2008-05-13 19:24:46 -04:00
|
|
|
|
|
|
|
[
|
|
|
|
utf8 <pipe> [
|
2010-07-30 15:58:33 -04:00
|
|
|
1 seconds over set-timeout
|
2008-05-13 19:24:46 -04:00
|
|
|
stream-readln
|
|
|
|
] with-disposal
|
|
|
|
] must-fail
|
2008-05-20 22:59:29 -04:00
|
|
|
|
|
|
|
[ ] [
|
|
|
|
1000 [
|
|
|
|
utf8 <pipe> [
|
|
|
|
[ in>> dispose ]
|
|
|
|
[ out>> "hi" over stream-write dispose ]
|
|
|
|
bi
|
|
|
|
] curry ignore-errors
|
|
|
|
] times
|
|
|
|
] unit-test
|
2010-07-30 15:58:33 -04:00
|
|
|
|
|
|
|
! 0 read should not block
|
|
|
|
[ f ] [
|
|
|
|
[
|
|
|
|
binary <pipe> &dispose
|
|
|
|
in>>
|
|
|
|
[ 0 read ] with-input-stream
|
|
|
|
] with-destructors
|
|
|
|
] unit-test
|