define a method on stream-element-type, fix a bug in unlimited-input and add a unit test
parent
1fb7cf37c4
commit
69229032c2
|
@ -82,3 +82,10 @@ IN: io.streams.limited.tests
|
||||||
[ f stream-throws limit-input 4 read ]
|
[ f stream-throws limit-input 4 read ]
|
||||||
with-string-reader
|
with-string-reader
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
|
||||||
|
[ "asdf" ] [
|
||||||
|
"asdf" <string-reader> 2 stream-eofs <limited-stream> [
|
||||||
|
unlimited-input contents
|
||||||
|
] with-input-stream
|
||||||
|
] unit-test
|
||||||
|
|
|
@ -37,7 +37,7 @@ M: decoder unlimited ( stream -- stream' )
|
||||||
[ stream>> ] change-stream ;
|
[ stream>> ] change-stream ;
|
||||||
|
|
||||||
M: object unlimited ( stream -- stream' )
|
M: object unlimited ( stream -- stream' )
|
||||||
stream>> stream>> ;
|
stream>> ;
|
||||||
|
|
||||||
: limit-input ( limit mode -- )
|
: limit-input ( limit mode -- )
|
||||||
[ input-stream ] 2dip '[ _ _ limit ] change ;
|
[ input-stream ] 2dip '[ _ _ limit ] change ;
|
||||||
|
@ -103,3 +103,6 @@ M: limited-stream stream-seek
|
||||||
|
|
||||||
M: limited-stream dispose
|
M: limited-stream dispose
|
||||||
stream>> dispose ;
|
stream>> dispose ;
|
||||||
|
|
||||||
|
M: limited-stream stream-element-type
|
||||||
|
stream>> stream-element-type ;
|
||||||
|
|
Loading…
Reference in New Issue