add unit test, fix bounds check error in limited streams

db4
U-C4\Administrator 2009-01-19 18:19:12 -06:00
parent 07fc5f3ff4
commit e323ae3a32
2 changed files with 4 additions and 1 deletions

View File

@ -38,3 +38,6 @@ namespaces tools.test strings kernel ;
"l" read-until
] with-input-stream
] unit-test
[ CHAR: a ]
[ "a" <string-reader> 1 <limited-stream> stream-read1 ] unit-test

2
basis/io/streams/limited/limited.factor Normal file → Executable file
View File

@ -24,7 +24,7 @@ ERROR: limit-exceeded ;
: check-limit ( n stream -- )
[ + ] change-count
[ count>> ] [ limit>> ] bi >=
[ count>> ] [ limit>> ] bi >
[ limit-exceeded ] when ; inline
M: limited-stream stream-read1