From 95dc2f89e566d5d1ddffb49f152d7890a3fc0d48 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 30 Mar 2016 16:28:39 -0700 Subject: [PATCH] io.mmap: Clean up mmap tests so they can run at the same time. --- basis/io/mmap/mmap-tests.factor | 46 ++++++++++++--------------------- 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/basis/io/mmap/mmap-tests.factor b/basis/io/mmap/mmap-tests.factor index d17b03290b..ef92d0271b 100644 --- a/basis/io/mmap/mmap-tests.factor +++ b/basis/io/mmap/mmap-tests.factor @@ -1,40 +1,26 @@ USING: alien.c-types alien.data compiler.tree.debugger -continuations io.directories io.encodings.ascii io.files -io.files.temp io.mmap kernel math sequences sequences.private +io.encodings.ascii io.files io.files.temp io.files.unique +io.mmap kernel locals math sequences sequences.private specialized-arrays tools.test ; -SPECIALIZED-ARRAY: uint IN: io.mmap.tests -[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors -{ } [ "12345" "mmap-test-file.txt" temp-file ascii set-file-contents ] unit-test -{ } [ "mmap-test-file.txt" temp-file [ char CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test -{ 5 } [ "mmap-test-file.txt" temp-file [ char length ] with-mapped-file ] unit-test -{ 5 } [ "mmap-test-file.txt" temp-file [ char length ] with-mapped-file-reader ] unit-test -{ "22345" } [ "mmap-test-file.txt" temp-file ascii file-contents ] unit-test - SPECIALIZED-ARRAY: uint -{ t } [ - "mmap-test-file.txt" temp-file uint [ sum ] with-mapped-array - integer? -] unit-test - -{ t } [ - "mmap-test-file.txt" temp-file uint [ sum ] with-mapped-array-reader - integer? -] unit-test - -[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors - - -[ "mmap-empty-file.txt" temp-file delete-file ] ignore-errors -{ } [ "mmap-empty-file.txt" temp-file touch-file ] unit-test - [ - "mmap-empty-file.txt" temp-file [ - drop - ] with-mapped-file -] [ bad-mmap-size? ] must-fail-with + "mmap-test-file" ".txt" [| path | + "12345" path ascii set-file-contents + { } [ path [ char CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test + { 5 } [ path [ char length ] with-mapped-file ] unit-test + { 5 } [ path [ char length ] with-mapped-file-reader ] unit-test + { "22345" } [ path ascii file-contents ] unit-test + { t } [ path uint [ sum ] with-mapped-array integer? ] unit-test + { t } [ path uint [ sum ] with-mapped-array-reader integer? ] unit-test + ] cleanup-unique-file + + "mmap-empty-file" ".txt" [| path | + [ path [ drop ] with-mapped-file ] [ bad-mmap-size? ] must-fail-with + ] cleanup-unique-file +] with-temp-directory { t } [ [ "test.txt" void* first-unsafe ]