factor/core/io/io-tests.factor

50 lines
1.1 KiB
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
USING: arrays io io.files kernel math parser strings system
2008-03-21 14:07:17 -04:00
tools.test words namespaces io.encodings.8-bit
io.encodings.binary ;
2008-03-01 17:00:45 -05:00
IN: io.tests
2007-09-20 18:09:08 -04:00
[ f ] [
2008-03-26 18:07:50 -04:00
"resource:core/io/test/no-trailing-eol.factor" run-file
2008-03-01 17:00:45 -05:00
"foo" "io.tests" lookup
2007-09-20 18:09:08 -04:00
] unit-test
[
"This is a line.\rThis is another line.\r"
] [
2008-05-06 15:41:59 -04:00
"resource:core/io/test/mac-os-eol.txt" latin1 <file-reader>
[ 500 read ] with-input-stream
2007-09-20 18:09:08 -04:00
] unit-test
[
255
] [
2008-05-06 15:41:59 -04:00
"resource:core/io/test/binary.txt" latin1 <file-reader>
[ read1 ] with-input-stream >fixnum
2007-09-20 18:09:08 -04:00
] unit-test
! Make sure we use correct to_c_string form when writing
[ ] [ "\0" write ] unit-test
[
{
{ "It seems " CHAR: J }
{ "obs has lost h" CHAR: i }
{ "s grasp on reality again.\n" f }
}
] [
[
2008-05-06 15:41:59 -04:00
"resource:core/io/test/separator-test.txt"
latin1 <file-reader> [
2007-09-20 18:09:08 -04:00
"J" read-until 2array ,
"i" read-until 2array ,
"X" read-until 2array ,
] with-input-stream
2007-09-20 18:09:08 -04:00
] { } make
] unit-test
[ ] [
image binary [
2007-09-20 18:09:08 -04:00
10 [ 65536 read drop ] times
] with-file-reader
2007-09-20 18:09:08 -04:00
] unit-test