1 USING: arrays debugger.threads destructors io io.directories
2 io.encodings.8-bit io.encodings.ascii io.encodings.binary
3 io.files io.files.private io.files.temp io.files.unique kernel
4 make math sequences system threads tools.test ;
10 [ ] [ "append-test" temp-file dup exists? [ delete-file ] [ drop ] if ] unit-test
12 [ ] [ "append-test" temp-file ascii <file-appender> dispose ] unit-test
15 "This is a line.\rThis is another line.\r"
17 "vocab:io/test/mac-os-eol.txt" latin1 <file-reader>
18 [ 500 read ] with-input-stream
24 "vocab:io/test/binary.txt" latin1 <file-reader>
25 [ read1 ] with-input-stream >fixnum
29 "It seems Jobs has lost his grasp on reality again.\n"
30 "separator-test.txt" temp-file latin1 set-file-contents
35 { "It seems " CHAR: J }
36 { "obs has lost h" CHAR: i }
37 { "s grasp on reality again.\n" f }
41 "separator-test.txt" temp-file
42 latin1 <file-reader> [
43 "J" read-until 2array ,
44 "i" read-until 2array ,
45 "X" read-until 2array ,
52 10 [ 65536 read drop ] times
66 [ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
68 [ ] [ "test-quux.txt" temp-file delete-file ] unit-test
70 [ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
72 [ ] [ "test-quux.txt" "quux-test.txt" [ temp-file ] bi@ move-file ] unit-test
74 [ t ] [ "quux-test.txt" temp-file exists? ] unit-test
76 [ ] [ "quux-test.txt" temp-file delete-file ] unit-test
81 "seek-test1" unique-file binary
84 B{ 1 2 3 4 5 } write 0 seek-absolute seek-output
94 "seek-test2" unique-file binary
97 B{ 1 2 3 4 5 } write -1 seek-relative seek-output
105 [ B{ 1 2 3 4 5 0 3 } ]
107 "seek-test3" unique-file binary
110 B{ 1 2 3 4 5 } write 1 seek-relative seek-output
120 B{ 1 2 3 4 5 } "seek-test4" unique-file binary [
124 -3 seek-end seek-input 1 read
131 B{ 1 2 3 4 5 } "seek-test5" unique-file binary [
135 3 seek-absolute seek-input
136 -2 seek-relative seek-input
143 "seek-test6" unique-file binary [
144 -10 seek-absolute seek-input