-USING: accessors io kernel math parser tools.test words ;
+USING: accessors io io.streams.string kernel math parser sbufs
+sequences tools.test words ;
IN: io.tests
{ f } [
[ stream-nl ]
[ vector>> ] tri
] unit-test
+
+{ SBUF" asdf" }
+[ "asdf" <string-reader> 4 <sbuf> [ stream-copy ] keep ] unit-test
: contents* ( -- seq )
input-stream get stream-contents* ; inline
+: stream-copy* ( in out -- )
+ [ stream-write ] curry each-stream-block ; inline
+
: stream-copy ( in out -- )
- [ [ [ write ] each-block ] with-output-stream ]
- curry with-input-stream ;
+ [ [ stream-copy* ] with-disposal ] curry with-disposal ;
! Default implementations of stream operations in terms of read1/write1