2008-12-14 22:21:44 -05:00
|
|
|
USING: io io.mmap io.mmap.char io.files io.files.temp
|
|
|
|
io.directories kernel tools.test continuations sequences
|
2009-02-26 19:11:07 -05:00
|
|
|
io.encodings.ascii accessors math ;
|
2008-03-01 17:00:45 -05:00
|
|
|
IN: io.mmap.tests
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2008-05-15 06:20:42 -04:00
|
|
|
[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
|
|
|
|
[ ] [ "12345" "mmap-test-file.txt" temp-file ascii set-file-contents ] unit-test
|
2008-12-02 22:50:34 -05:00
|
|
|
[ ] [ "mmap-test-file.txt" temp-file [ CHAR: 2 0 pick set-nth drop ] with-mapped-char-file ] unit-test
|
|
|
|
[ 5 ] [ "mmap-test-file.txt" temp-file [ length ] with-mapped-char-file ] unit-test
|
2008-05-15 06:20:42 -04:00
|
|
|
[ "22345" ] [ "mmap-test-file.txt" temp-file ascii file-contents ] unit-test
|
|
|
|
[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
|
2009-02-26 18:34:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
[ ]
|
|
|
|
[ "mmap-empty-file.txt" temp-file touch-file ] unit-test
|
|
|
|
|
|
|
|
! Test for leaking resources bug on Unix
|
|
|
|
[ ]
|
|
|
|
[
|
|
|
|
100000 [
|
|
|
|
[
|
|
|
|
"mmap-empty-file.txt" temp-file [
|
|
|
|
drop
|
|
|
|
] with-mapped-file
|
|
|
|
] [ dup bad-mmap-size? [ drop ] [ rethrow ] if ] recover
|
|
|
|
] times
|
|
|
|
|
|
|
|
"asdf" "mmap-asdf-file.txt" temp-file [ ascii set-file-contents ] keep [
|
|
|
|
drop
|
|
|
|
] with-mapped-file
|
|
|
|
] unit-test
|