1 USING: tools.test io.files io.files.private io.files.temp
2 io.directories io.encodings.8-bit arrays make system
3 io.encodings.binary io threads kernel continuations
4 io.encodings.ascii sequences strings accessors
5 io.encodings.utf8 math destructors namespaces ;
11 [ ] [ "append-test" temp-file dup exists? [ delete-file ] [ drop ] if ] unit-test
13 [ ] [ "append-test" temp-file ascii <file-appender> dispose ] unit-test
16 "This is a line.\rThis is another line.\r"
18 "resource:core/io/test/mac-os-eol.txt" latin1 <file-reader>
19 [ 500 read ] with-input-stream
25 "resource:core/io/test/binary.txt" latin1 <file-reader>
26 [ read1 ] with-input-stream >fixnum
30 "It seems Jobs has lost his grasp on reality again.\n"
31 "separator-test.txt" temp-file latin1 set-file-contents
36 { "It seems " CHAR: J }
37 { "obs has lost h" CHAR: i }
38 { "s grasp on reality again.\n" f }
42 "separator-test.txt" temp-file
43 latin1 <file-reader> [
44 "J" read-until 2array ,
45 "i" read-until 2array ,
46 "X" read-until 2array ,
53 10 [ 65536 read drop ] times
67 [ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
69 [ ] [ "test-quux.txt" temp-file delete-file ] unit-test
71 [ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
73 [ ] [ "test-quux.txt" "quux-test.txt" [ temp-file ] bi@ move-file ] unit-test
75 [ t ] [ "quux-test.txt" temp-file exists? ] unit-test
77 [ ] [ "quux-test.txt" temp-file delete-file ] unit-test