1 USING: tools.test io.files io.files.private io.files.temp
2 io.directories io.encodings.8-bit arrays make system
4 threads kernel continuations io.encodings.ascii sequences
5 strings accessors io.encodings.utf8 math destructors namespaces
10 \ (exists?) must-infer
12 [ ] [ "append-test" temp-file dup exists? [ delete-file ] [ drop ] if ] unit-test
14 [ ] [ "append-test" temp-file ascii <file-appender> dispose ] unit-test
17 "This is a line.\rThis is another line.\r"
19 "resource:core/io/test/mac-os-eol.txt" latin1 <file-reader>
20 [ 500 read ] with-input-stream
26 "resource:core/io/test/binary.txt" latin1 <file-reader>
27 [ read1 ] with-input-stream >fixnum
31 "It seems Jobs has lost his grasp on reality again.\n"
32 "separator-test.txt" temp-file latin1 set-file-contents
37 { "It seems " CHAR: J }
38 { "obs has lost h" CHAR: i }
39 { "s grasp on reality again.\n" f }
43 "separator-test.txt" temp-file
44 latin1 <file-reader> [
45 "J" read-until 2array ,
46 "i" read-until 2array ,
47 "X" read-until 2array ,
54 10 [ 65536 read drop ] times
68 [ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
70 [ ] [ "test-quux.txt" temp-file delete-file ] unit-test
72 [ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
74 [ ] [ "test-quux.txt" "quux-test.txt" [ temp-file ] bi@ move-file ] unit-test
76 [ t ] [ "quux-test.txt" temp-file exists? ] unit-test
78 [ ] [ "quux-test.txt" temp-file delete-file ] unit-test