stream-element-type on output-ports was broken -- it looked for a stream>> slot but no such slot exists. add some unit tests
parent
24c4637577
commit
7228c2df2c
|
@ -1,6 +1,6 @@
|
||||||
USING: alien.c-types alien.data destructors io io.directories
|
USING: accessors alien.c-types alien.data destructors io
|
||||||
io.encodings.binary io.files io.files.temp kernel libc math
|
io.directories io.encodings.ascii io.encodings.binary io.files
|
||||||
sequences tools.test ;
|
io.files.temp io.pipes kernel libc math sequences tools.test ;
|
||||||
IN: io.ports.tests
|
IN: io.ports.tests
|
||||||
|
|
||||||
! Make sure that writing malloced storage to a file works, and
|
! Make sure that writing malloced storage to a file works, and
|
||||||
|
@ -23,3 +23,9 @@ IN: io.ports.tests
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ] [ "test.txt" temp-file delete-file ] 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
|
|
@ -111,8 +111,7 @@ TUPLE: output-port < buffered-port ;
|
||||||
[ nip ] [ buffer>> buffer-capacity <= ] 2bi
|
[ nip ] [ buffer>> buffer-capacity <= ] 2bi
|
||||||
[ drop ] [ stream-flush ] if ; inline
|
[ drop ] [ stream-flush ] if ; inline
|
||||||
|
|
||||||
M: output-port stream-element-type
|
M: output-port stream-element-type drop +byte+ ; inline
|
||||||
stream>> stream-element-type ; inline
|
|
||||||
|
|
||||||
M: output-port stream-write1
|
M: output-port stream-write1
|
||||||
dup check-disposed
|
dup check-disposed
|
||||||
|
|
Loading…
Reference in New Issue