1 USING: io io.mmap io.mmap.char io.files io.files.temp
2 io.directories kernel tools.test continuations sequences
3 io.encodings.ascii accessors ;
6 [ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
7 [ ] [ "12345" "mmap-test-file.txt" temp-file ascii set-file-contents ] unit-test
8 [ ] [ "mmap-test-file.txt" temp-file [ CHAR: 2 0 pick set-nth drop ] with-mapped-char-file ] unit-test
9 [ 5 ] [ "mmap-test-file.txt" temp-file [ length ] with-mapped-char-file ] unit-test
10 [ "22345" ] [ "mmap-test-file.txt" temp-file ascii file-contents ] unit-test
11 [ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
15 [ "mmap-empty-file.txt" temp-file touch-file ] unit-test
17 ! Test for leaking resources bug on Unix
22 "mmap-empty-file.txt" temp-file [
25 ] [ dup bad-mmap-size? [ drop ] [ rethrow ] if ] recover
28 "asdf" "mmap-asdf-file.txt" temp-file [ ascii set-file-contents ] keep [