2004-08-22 21:56:06 -04:00
|
|
|
IN: scratchpad
|
|
|
|
USE: namespaces
|
|
|
|
USE: parser
|
|
|
|
USE: streams
|
|
|
|
USE: test
|
2004-09-02 23:00:30 -04:00
|
|
|
USE: stdio
|
|
|
|
USE: math
|
2004-08-22 21:56:06 -04:00
|
|
|
|
|
|
|
[ 4 ] [ "/library/test/io/no-trailing-eol.factor" run-resource ] unit-test
|
|
|
|
|
|
|
|
: lines-test ( stream -- line1 line2 )
|
2004-09-02 23:00:30 -04:00
|
|
|
[ read read ] with-stream ;
|
2004-08-22 21:56:06 -04:00
|
|
|
|
|
|
|
[
|
|
|
|
"This is a line."
|
|
|
|
"This is another line."
|
|
|
|
] [
|
|
|
|
"/library/test/io/windows-eol.txt" <resource-stream> lines-test
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[
|
|
|
|
"This is a line."
|
|
|
|
"This is another line."
|
|
|
|
] [
|
|
|
|
"/library/test/io/mac-os-eol.txt" <resource-stream> lines-test
|
|
|
|
] unit-test
|
2004-08-22 23:02:29 -04:00
|
|
|
|
|
|
|
[
|
|
|
|
"This is a line.\rThis is another line.\r"
|
|
|
|
] [
|
2004-09-02 23:00:30 -04:00
|
|
|
"/library/test/io/mac-os-eol.txt" <resource-stream>
|
|
|
|
[ 500 read# ] with-stream
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[
|
|
|
|
255
|
|
|
|
] [
|
|
|
|
"/library/test/io/binary.txt" <resource-stream>
|
|
|
|
[ read1 ] with-stream >fixnum
|
2004-08-22 23:02:29 -04:00
|
|
|
] unit-test
|
2004-11-13 18:07:18 -05:00
|
|
|
|
|
|
|
! Make sure we use correct to_c_string form when writing
|
|
|
|
[ ] [ "\0" write ] unit-test
|