io.streams.throwing: implement tell and seek
parent
0bdc1514fd
commit
99db070c9e
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2010 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: io io.streams.limited io.streams.string
|
||||
io.streams.throwing tools.test ;
|
||||
io.streams.throwing tools.test kernel ;
|
||||
IN: io.streams.throwing.tests
|
||||
|
||||
[ "as" ]
|
||||
|
@ -34,3 +34,13 @@ IN: io.streams.throwing.tests
|
|||
"asdf" <string-reader> 2 <limited-stream>
|
||||
[ contents contents ] throws-on-eof
|
||||
] [ stream-exhausted? ] must-fail-with
|
||||
|
||||
[
|
||||
"asdf" <string-reader> 2 <limited-stream>
|
||||
[ 1 seek-absolute seek-input 4 read drop ] throws-on-eof
|
||||
] [ stream-exhausted? ] must-fail-with
|
||||
|
||||
[ 1 ] [
|
||||
"asdf" <string-reader> 2 <limited-stream>
|
||||
[ 1 seek-absolute seek-input tell-input ] throws-on-eof
|
||||
] unit-test
|
||||
|
|
|
@ -28,6 +28,12 @@ M:: throws-on-eof stream-read-partial ( n stream -- seq )
|
|||
n stream stream>> stream-read-partial
|
||||
[ n stream \ read-partial stream-exhausted ] unless* ;
|
||||
|
||||
M: throws-on-eof stream-tell
|
||||
stream>> stream-tell ;
|
||||
|
||||
M: throws-on-eof stream-seek
|
||||
stream>> stream-seek ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: throws-on-eof ( stream quot -- )
|
||||
|
|
Loading…
Reference in New Issue