Streams fixes
parent
a233349c1f
commit
0cd8e61f24
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: io kernel math namespaces sequences sbufs strings
|
||||
generic splitting growable continuations io.streams.plain
|
||||
io.encodings io.encodings.private math.order ;
|
||||
io.encodings math.order ;
|
||||
IN: io.streams.string
|
||||
|
||||
M: growable dispose drop ;
|
||||
|
@ -77,6 +77,3 @@ M: plain-writer stream-write-table
|
|||
[ drop format-table [ print ] each ] with-output-stream* ;
|
||||
|
||||
M: plain-writer make-cell-stream 2drop <string-writer> ;
|
||||
|
||||
M: growable stream-readln ( stream -- str )
|
||||
"\r\n" over stream-read-until handle-readln ;
|
||||
|
|
|
@ -13,11 +13,12 @@ PROTOCOL: assoc-protocol
|
|||
delete-at clear-assoc new-assoc assoc-like ;
|
||||
|
||||
PROTOCOL: input-stream-protocol
|
||||
stream-read1 stream-read stream-read-until stream-read-quot ;
|
||||
stream-read1 stream-read stream-read-partial stream-readln
|
||||
stream-read-until stream-read-quot ;
|
||||
|
||||
PROTOCOL: output-stream-protocol
|
||||
stream-flush stream-write1 stream-write stream-format
|
||||
stream-nl make-span-stream make-block-stream stream-readln
|
||||
stream-nl make-span-stream make-block-stream
|
||||
make-cell-stream stream-write-table ;
|
||||
|
||||
PROTOCOL: definition-protocol
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
USING: io.streams.duplex io kernel continuations tools.test ;
|
||||
USING: io.streams.duplex io io.streams.string
|
||||
kernel continuations tools.test ;
|
||||
IN: io.streams.duplex.tests
|
||||
|
||||
! Test duplex stream close behavior
|
||||
|
@ -38,3 +39,8 @@ M: unclosable-stream dispose
|
|||
[ dup dispose ] [ 2drop ] recover
|
||||
] keep closing-stream-closed?
|
||||
] unit-test
|
||||
|
||||
[ "Hey" ] [
|
||||
"Hey\nThere" <string-reader> <string-writer> <duplex-stream>
|
||||
stream-readln
|
||||
] unit-test
|
||||
|
|
Loading…
Reference in New Issue