diff --git a/basis/io/mmap/mmap-docs.factor b/basis/io/mmap/mmap-docs.factor index 3379a2879b..fe16e08467 100644 --- a/basis/io/mmap/mmap-docs.factor +++ b/basis/io/mmap/mmap-docs.factor @@ -47,7 +47,7 @@ HELP: with-mapped-array { $description "Memory-maps a file for reading and writing as a mapped-array of the given c-type. The mapped file is disposed of when the quotation returns, or if an error is thrown." } { $examples { $unchecked-example - "USING: io.mmap prettyprint specialized-arrays ;" + "USING: alien.c-types io.mmap prettyprint specialized-arrays ;" "SPECIALIZED-ARRAY: uint" """"resource:license.txt" uint [ [ . ] each diff --git a/basis/io/mmap/mmap-tests.factor b/basis/io/mmap/mmap-tests.factor index 3ed3447603..94f8c77883 100644 --- a/basis/io/mmap/mmap-tests.factor +++ b/basis/io/mmap/mmap-tests.factor @@ -1,7 +1,7 @@ -USING: io io.mmap io.files io.files.temp io.directories kernel -tools.test continuations sequences io.encodings.ascii accessors -math compiler.tree.debugger alien.data alien.c-types -sequences.private ; +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 +specialized-arrays specialized-arrays.instances.uint tools.test ; IN: io.mmap.tests [ "mmap-test-file.txt" temp-file delete-file ] ignore-errors @@ -10,6 +10,19 @@ IN: io.mmap.tests [ 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