add unit test, fix bounds check error in limited streams
							parent
							
								
									07fc5f3ff4
								
							
						
					
					
						commit
						e323ae3a32
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue