stream-element-type on output-ports was broken -- it looked for a stream>> slot but no such slot exists. add some unit tests

db4
Doug Coleman 2011-10-12 01:05:01 -07:00
parent 24c4637577
commit 7228c2df2c
2 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,6 @@
USING: alien.c-types alien.data destructors io io.directories
io.encodings.binary io.files io.files.temp kernel libc math
sequences tools.test ;
USING: accessors alien.c-types alien.data destructors io
io.directories io.encodings.ascii io.encodings.binary io.files
io.files.temp io.pipes kernel libc math sequences tools.test ;
IN: io.ports.tests
! Make sure that writing malloced storage to a file works, and
@ -23,3 +23,9 @@ IN: io.ports.tests
] unit-test
[ ] [ "test.txt" temp-file delete-file ] unit-test
! Getting the stream-element-type of an output-port was broken
[ +byte+ ] [ binary <pipe> [ stream-element-type ] [ dispose ] bi ] unit-test
[ +byte+ ] [ binary <pipe> [ out>> stream-element-type ] [ dispose ] bi ] unit-test
[ +character+ ] [ ascii <pipe> [ stream-element-type ] [ dispose ] bi ] unit-test
[ +character+ ] [ ascii <pipe> [ out>> stream-element-type ] [ dispose ] bi ] unit-test

View File

@ -111,8 +111,7 @@ TUPLE: output-port < buffered-port ;
[ nip ] [ buffer>> buffer-capacity <= ] 2bi
[ drop ] [ stream-flush ] if ; inline
M: output-port stream-element-type
stream>> stream-element-type ; inline
M: output-port stream-element-type drop +byte+ ; inline
M: output-port stream-write1
dup check-disposed