2011-10-12 04:05:01 -04:00
|
|
|
USING: accessors alien.c-types alien.data destructors io
|
2016-03-31 03:23:13 -04:00
|
|
|
io.encodings.ascii io.encodings.binary io.encodings.string
|
2016-04-04 13:32:42 -04:00
|
|
|
io.encodings.utf8 io.files io.pipes io.sockets kernel libc
|
|
|
|
locals math namespaces sequences tools.test ;
|
2010-02-24 02:18:41 -05:00
|
|
|
|
|
|
|
! Make sure that writing malloced storage to a file works, and
|
|
|
|
! also make sure that writes larger than the buffer size work
|
|
|
|
|
2016-04-04 13:32:42 -04:00
|
|
|
[| path |
|
2010-02-24 02:18:41 -05:00
|
|
|
|
2016-04-04 13:32:42 -04:00
|
|
|
{ } [
|
|
|
|
path binary [
|
|
|
|
[
|
2017-06-01 17:59:35 -04:00
|
|
|
100,000 <iota>
|
2016-04-04 13:32:42 -04:00
|
|
|
0
|
|
|
|
100,000 int malloc-array &free [ copy ] keep write
|
|
|
|
] with-destructors
|
|
|
|
] with-file-writer
|
|
|
|
] unit-test
|
2010-02-24 02:18:41 -05:00
|
|
|
|
2016-04-04 13:32:42 -04:00
|
|
|
{ t } [
|
|
|
|
path binary [
|
2017-06-01 17:59:35 -04:00
|
|
|
100,000 4 * read int cast-array 100,000 <iota> sequence=
|
2016-04-04 13:32:42 -04:00
|
|
|
] with-file-reader
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
] with-test-file
|
2011-10-12 04:05:01 -04:00
|
|
|
|
|
|
|
! Getting the stream-element-type of an output-port was broken
|
2015-07-03 12:39:59 -04:00
|
|
|
{ +byte+ } [ binary <pipe> [ stream-element-type ] with-disposal ] unit-test
|
|
|
|
{ +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
|
2014-12-23 16:47:50 -05:00
|
|
|
|
|
|
|
! 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
|