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 ;
+io.directories io.encodings.ascii io.encodings.binary
+io.encodings.string io.encodings.utf8 io.files io.files.temp
+io.pipes io.sockets kernel libc math namespaces sequences
+tools.test ;
IN: io.ports.tests
! Make sure that writing malloced storage to a file works, and
[ +byte+ ] [ binary <pipe> [ out>> stream-element-type ] with-disposal ] unit-test
[ +character+ ] [ ascii <pipe> [ stream-element-type ] with-disposal ] unit-test
[ +character+ ] [ ascii <pipe> [ out>> stream-element-type ] with-disposal ] unit-test
+
+! Issue #1256 regression test
+! Port length would be zero before data is received
+{ f } [
+ "google.com" 80 <inet> binary [
+ "GET /\n" utf8 encode write flush
+ input-stream get stream-contents
+ ] with-client empty?
+] unit-test
M: buffered-port stream-seekable?
handle>> can-seek-handle? ;
+! Cannot be ``handle>> handle-length`` because of a race condition.
M: buffered-port stream-length
- handle>> handle-length ;
+ drop f ;
GENERIC: shutdown ( handle -- )