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