Updating unit tests for I/O re-organization
parent
50e214c152
commit
dccbb84629
|
@ -14,6 +14,7 @@ TYPEDEF: int SInt32
|
|||
TYPEDEF: uint UInt32
|
||||
TYPEDEF: ulong CFTypeID
|
||||
TYPEDEF: UInt32 CFOptionFlags
|
||||
TYPEDEF: void* CFUUIDRef
|
||||
|
||||
FUNCTION: CFTypeRef CFRetain ( CFTypeRef cf ) ;
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ TYPEDEF: void* CFDictionaryRef
|
|||
TYPEDEF: void* CFMutableDictionaryRef
|
||||
TYPEDEF: void* CFNumberRef
|
||||
TYPEDEF: void* CFSetRef
|
||||
TYPEDEF: void* CFUUIDRef
|
||||
|
||||
TYPEDEF: int CFNumberType
|
||||
: kCFNumberSInt8Type 1 ; inline
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
USING: io.files io.sockets io kernel threads
|
||||
USING: io.files io.files.temp io.directories io.sockets io kernel threads
|
||||
namespaces tools.test continuations strings byte-arrays
|
||||
sequences prettyprint system io.encodings.binary io.encodings.ascii
|
||||
io.streams.duplex destructors make ;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
USING: continuations destructors io io.directories
|
||||
io.encodings.ascii io.encodings.utf8 io.files io.files.info
|
||||
io.files.temp io.pathnames kernel sequences tools.test ;
|
||||
IN: io.directories.tests
|
||||
|
||||
[ { "kernel" } ] [
|
||||
|
@ -127,20 +130,6 @@ IN: io.directories.tests
|
|||
|
||||
[ f ] [ "test-blah" temp-file exists? ] unit-test
|
||||
|
||||
USE: debugger.threads
|
||||
|
||||
[ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
|
||||
|
||||
[ ] [ "test-quux.txt" temp-file delete-file ] unit-test
|
||||
|
||||
[ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
|
||||
|
||||
[ ] [ "test-quux.txt" "quux-test.txt" [ temp-file ] bi@ move-file ] unit-test
|
||||
|
||||
[ t ] [ "quux-test.txt" temp-file exists? ] unit-test
|
||||
|
||||
[ ] [ "quux-test.txt" temp-file delete-file ] unit-test
|
||||
|
||||
[ ] [ "delete-tree-test/a/b/c" temp-file make-directories ] unit-test
|
||||
|
||||
[ ] [
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
! Copyright (C) 2004, 2008 Slava Pestov, Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: vocabs.loader combinators ;
|
||||
USING: accessors combinators destructors io io.backend
|
||||
io.encodings.binary io.files io.files.info io.files.links
|
||||
io.pathnames kernel namespaces sequences system vocabs.loader ;
|
||||
IN: io.directories
|
||||
|
||||
: set-current-directory ( path -- )
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
USING: io.paths kernel tools.test io.files.unique sequences
|
||||
io.files namespaces sorting ;
|
||||
IN: io.paths.tests
|
||||
USING: io.directories.search io.files io.files.unique
|
||||
io.pathnames kernel namespaces sequences sorting tools.test ;
|
||||
IN: io.directories.search.tests
|
||||
|
||||
[ t ] [
|
||||
[
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays deques dlists io.files
|
||||
kernel sequences system vocabs.loader fry continuations ;
|
||||
USING: accessors arrays continuations deques dlists fry
|
||||
io.directories io.directories.search.private io.files
|
||||
io.files.info io.pathnames kernel sequences system
|
||||
vocabs.loader ;
|
||||
IN: io.directories.search
|
||||
|
||||
TUPLE: directory-iterator path bfs queue ;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays continuations fry io.files io.paths
|
||||
kernel windows.shell32 sequences ;
|
||||
IN: io.paths.windows
|
||||
USING: arrays fry io.pathnames kernel sequences windows.shell32 ;
|
||||
IN: io.paths
|
||||
|
||||
: program-files-directories ( -- array )
|
||||
program-files program-files-x86 2array ; inline
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: math.bitwise io.backend kernel io.files unix
|
||||
io.backend.unix io.encodings.binary io.directories io destructors
|
||||
accessors io.files.info alien.c-types io.encodings.utf8 fry
|
||||
sequences system continuations alien.strings ;
|
||||
USING: accessors alien.c-types alien.strings combinators
|
||||
continuations destructors fry io io.backend io.backend.unix
|
||||
io.directories io.encodings.binary io.encodings.utf8 io.files
|
||||
io.files.info io.pathnames kernel math.bitwise sequences system
|
||||
unix unix.stat ;
|
||||
IN: io.directories.unix
|
||||
|
||||
: touch-mode ( -- n )
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
USING: io.files.info io.pathnames io.encodings.utf8 io.files
|
||||
io.directories kernel io.pathnames accessors tools.test
|
||||
sequences io.files.temp ;
|
||||
IN: io.files.info.tests
|
||||
|
||||
\ file-info must-infer
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
! Copyright (C) 2008 Slava Pestov, Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: system kernel vocabs.loader ;
|
||||
IN: io.files.links
|
||||
|
||||
HOOK: make-link io-backend ( target symlink -- )
|
||||
HOOK: make-link os ( target symlink -- )
|
||||
|
||||
HOOK: read-link io-backend ( symlink -- path )
|
||||
HOOK: read-link os ( symlink -- path )
|
||||
|
||||
: copy-link ( target symlink -- )
|
||||
[ read-link ] dip make-link ;
|
||||
[ read-link ] dip make-link ;
|
||||
|
||||
os unix? [ "io.files.links.unix" require ] when
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: io.backend io.backend.unix system unix ;
|
||||
USING: io.backend io.files.links system unix ;
|
||||
IN: io.files.links.unix
|
||||
|
||||
M: unix make-link ( path1 path2 -- )
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
USING: io.encodings.ascii sequences strings io io.files accessors
|
||||
tools.test kernel io.files.unique namespaces continuations ;
|
||||
tools.test kernel io.files.unique namespaces continuations
|
||||
io.files.info io.pathnames ;
|
||||
IN: io.files.unique.tests
|
||||
|
||||
[ 123 ] [
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel math math.bitwise math.parser random sequences
|
||||
continuations namespaces io.files io arrays system
|
||||
combinators vocabs.loader fry io.backend ;
|
||||
USING: arrays combinators continuations fry io io.backend
|
||||
io.directories io.files io.files.unique.private io.pathnames
|
||||
kernel math math.bitwise math.parser namespaces random
|
||||
sequences system vocabs.loader ;
|
||||
IN: io.files.unique
|
||||
|
||||
HOOK: touch-unique-file io-backend ( path -- )
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
USING: tools.test io.files continuations kernel io.files.unix
|
||||
math.bitwise calendar accessors math.functions math unix.users
|
||||
unix.groups arrays sequences ;
|
||||
USING: tools.test io.files io.files.temp io.pathnames
|
||||
io.directories io.files.info io.files.info.unix continuations
|
||||
kernel io.files.unix math.bitwise calendar accessors
|
||||
math.functions math unix.users unix.groups arrays sequences ;
|
||||
IN: io.files.unix.tests
|
||||
|
||||
[ "/usr/libexec/" ] [ "/usr/libexec/awk/" parent-directory ] unit-test
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
IN: io.launcher.unix.tests
|
||||
USING: io.files tools.test io.launcher arrays io namespaces
|
||||
continuations math io.encodings.binary io.encodings.ascii
|
||||
accessors kernel sequences io.encodings.utf8 destructors
|
||||
io.streams.duplex locals concurrency.promises threads
|
||||
unix.process ;
|
||||
USING: io.files io.files.temp io.directories io.pathnames
|
||||
tools.test io.launcher arrays io namespaces continuations math
|
||||
io.encodings.binary io.encodings.ascii accessors kernel
|
||||
sequences io.encodings.utf8 destructors io.streams.duplex locals
|
||||
concurrency.promises threads unix.process ;
|
||||
|
||||
[ ] [
|
||||
[ "launcher-test-1" temp-file delete-file ] ignore-errors
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
! Copyright (C) 2007, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel namespaces math system sequences
|
||||
continuations arrays assocs combinators alien.c-types strings
|
||||
threads accessors environment
|
||||
io io.backend io.launcher io.ports io.files
|
||||
io.files.private io.files.unix io.backend.unix
|
||||
io.launcher.unix.parser
|
||||
unix unix.process ;
|
||||
USING: accessors alien.c-types arrays assocs combinators
|
||||
continuations environment io io.backend io.backend.unix
|
||||
io.files io.files.private io.files.unix io.launcher
|
||||
io.launcher.unix.parser io.pathnames io.ports kernel math
|
||||
namespaces sequences strings system threads unix unix
|
||||
unix.process ;
|
||||
IN: io.launcher.unix
|
||||
|
||||
! Search unix first
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
USING: io io.mmap io.mmap.char io.files kernel tools.test
|
||||
continuations sequences io.encodings.ascii accessors ;
|
||||
USING: io io.mmap io.mmap.char io.files io.files.temp
|
||||
io.directories kernel tools.test continuations sequences
|
||||
io.encodings.ascii accessors ;
|
||||
IN: io.mmap.tests
|
||||
|
||||
[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
! Copyright (C) 2007, 2008 Doug Coleman, Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: continuations destructors io.files io.backend kernel
|
||||
quotations system alien alien.accessors accessors system
|
||||
vocabs.loader combinators alien.c-types ;
|
||||
USING: continuations destructors io.files io.files.info
|
||||
io.backend kernel quotations system alien alien.accessors
|
||||
accessors system vocabs.loader combinators alien.c-types ;
|
||||
IN: io.mmap
|
||||
|
||||
TUPLE: mapped-file address handle length disposed ;
|
||||
|
||||
HOOK: (mapped-file) io-backend ( path length -- address handle )
|
||||
HOOK: (mapped-file) os ( path length -- address handle )
|
||||
|
||||
: <mapped-file> ( path -- mmap )
|
||||
[ normalize-path ] [ file-info size>> ] bi [ (mapped-file) ] keep
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
IN: io.monitors.tests
|
||||
USING: io.monitors tools.test io.files system sequences
|
||||
continuations namespaces concurrency.count-downs kernel io
|
||||
threads calendar prettyprint destructors io.timeouts ;
|
||||
threads calendar prettyprint destructors io.timeouts
|
||||
io.files.temp io.directories io.pathnames ;
|
||||
|
||||
os { winnt linux macosx } member? [
|
||||
[
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Doug Coleman
|
|
@ -1,11 +0,0 @@
|
|||
USING: io.paths kernel tools.test io.files.unique sequences
|
||||
io.files namespaces sorting ;
|
||||
IN: io.paths.tests
|
||||
|
||||
[ t ] [
|
||||
[
|
||||
10 [ "io.paths.test" "gogogo" make-unique-file* ] replicate
|
||||
current-directory get t [ ] find-all-files
|
||||
] with-unique-directory
|
||||
[ natural-sort ] bi@ =
|
||||
] unit-test
|
|
@ -1,58 +0,0 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays deques dlists io.files
|
||||
kernel sequences system vocabs.loader fry continuations ;
|
||||
IN: io.paths
|
||||
|
||||
TUPLE: directory-iterator path bfs queue ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
: qualified-directory ( path -- seq )
|
||||
dup directory-files [ append-path ] with map ;
|
||||
|
||||
: push-directory ( path iter -- )
|
||||
[ qualified-directory ] dip [
|
||||
dup queue>> swap bfs>>
|
||||
[ push-front ] [ push-back ] if
|
||||
] curry each ;
|
||||
|
||||
: <directory-iterator> ( path bfs? -- iterator )
|
||||
<dlist> directory-iterator boa
|
||||
dup path>> over push-directory ;
|
||||
|
||||
: next-file ( iter -- file/f )
|
||||
dup queue>> deque-empty? [ drop f ] [
|
||||
dup queue>> pop-back dup link-info directory?
|
||||
[ over push-directory next-file ] [ nip ] if
|
||||
] if ;
|
||||
|
||||
: iterate-directory ( iter quot: ( obj -- ? ) -- obj )
|
||||
over next-file [
|
||||
over call
|
||||
[ 2nip ] [ iterate-directory ] if*
|
||||
] [
|
||||
2drop f
|
||||
] if* ; inline recursive
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: find-file ( path bfs? quot: ( obj -- ? ) -- path/f )
|
||||
[ <directory-iterator> ] dip
|
||||
[ keep and ] curry iterate-directory ; inline
|
||||
|
||||
: each-file ( path bfs? quot: ( obj -- ? ) -- )
|
||||
[ <directory-iterator> ] dip
|
||||
[ f ] compose iterate-directory drop ; inline
|
||||
|
||||
: find-all-files ( path bfs? quot: ( obj -- ? ) -- paths )
|
||||
[ <directory-iterator> ] dip
|
||||
pusher [ [ f ] compose iterate-directory drop ] dip ; inline
|
||||
|
||||
: recursive-directory ( path bfs? -- paths )
|
||||
[ ] accumulator [ each-file ] dip ;
|
||||
|
||||
: find-in-directories ( directories bfs? quot -- path' )
|
||||
'[ _ _ find-file ] attempt-all ; inline
|
||||
|
||||
os windows? [ "io.paths.windows" require ] when
|
|
@ -1 +0,0 @@
|
|||
Doug Coleman
|
|
@ -1 +0,0 @@
|
|||
unportable
|
|
@ -1,13 +0,0 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays continuations fry io.files io.paths
|
||||
kernel windows.shell32 sequences ;
|
||||
IN: io.paths.windows
|
||||
|
||||
: program-files-directories ( -- array )
|
||||
program-files program-files-x86 2array ; inline
|
||||
|
||||
: find-in-program-files ( base-directory bfs? quot -- path )
|
||||
[
|
||||
[ program-files-directories ] dip '[ _ append-path ] map
|
||||
] 2dip find-in-directories ; inline
|
|
@ -1,10 +1,10 @@
|
|||
! Copyright (C) 2007, 2008, Slava Pestov, Elie CHAFTARI.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors byte-arrays kernel sequences
|
||||
namespaces math math.order combinators init alien alien.c-types
|
||||
alien.strings libc continuations destructors summary
|
||||
splitting assocs random math.parser locals unicode.case openssl
|
||||
openssl.libcrypto openssl.libssl io.backend io.ports io.files
|
||||
USING: accessors byte-arrays kernel sequences namespaces math
|
||||
math.order combinators init alien alien.c-types alien.strings
|
||||
libc continuations destructors summary splitting assocs random
|
||||
math.parser locals unicode.case openssl openssl.libcrypto
|
||||
openssl.libssl io.backend io.ports io.pathnames
|
||||
io.encodings.8-bit io.timeouts io.sockets.secure ;
|
||||
IN: io.sockets.secure.openssl
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: alien alien.c-types alien.strings generic kernel math
|
||||
namespaces threads sequences byte-arrays io.ports
|
||||
io.binary io.backend.unix io.streams.duplex
|
||||
io.backend io.ports io.files io.files.private
|
||||
io.backend io.ports io.pathnames io.files.private
|
||||
io.encodings.utf8 math.parser continuations libc combinators
|
||||
system accessors qualified destructors unix locals init ;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
! Copyright (C) 2007, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel io io.styles io.files io.encodings.utf8
|
||||
vocabs.loader vocabs sequences namespaces make math.parser
|
||||
arrays hashtables assocs memoize summary sorting splitting
|
||||
combinators source-files debugger continuations compiler.errors
|
||||
init checksums checksums.crc32 sets accessors generic
|
||||
definitions words ;
|
||||
USING: kernel io io.styles io.files io.files.info io.directories
|
||||
io.pathnames io.encodings.utf8 vocabs.loader vocabs sequences
|
||||
namespaces make math.parser arrays hashtables assocs memoize
|
||||
summary sorting splitting combinators source-files debugger
|
||||
continuations compiler.errors init checksums checksums.crc32
|
||||
sets accessors generic definitions words ;
|
||||
IN: tools.vocabs
|
||||
|
||||
: vocab-xref ( vocab quot -- vocabs )
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
USING: alien alien.c-types alien.strings alien.syntax combinators
|
||||
kernel windows windows.user32 windows.ole32
|
||||
windows.com windows.com.syntax io.files io.encodings.utf16n ;
|
||||
! Copyright (C) 2006, 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien alien.c-types alien.strings alien.syntax
|
||||
combinators io.encodings.utf16n io.files io.pathnames kernel
|
||||
windows windows.com windows.com.syntax windows.ole32
|
||||
windows.user32 ;
|
||||
IN: windows.shell32
|
||||
|
||||
: CSIDL_DESKTOP HEX: 00 ; inline
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
USING: tools.test io.files io.files.private io.files.temp
|
||||
io.directories io.encodings.8-bit arrays make system
|
||||
io.encodings.binary io
|
||||
threads kernel continuations io.encodings.ascii sequences
|
||||
strings accessors io.encodings.utf8 math destructors namespaces
|
||||
;
|
||||
IN: io.files.tests
|
||||
USING: tools.test io.files io.files.private io threads kernel
|
||||
continuations io.encodings.ascii sequences
|
||||
strings accessors io.encodings.utf8 math destructors
|
||||
namespaces ;
|
||||
|
||||
\ exists? must-infer
|
||||
\ (exists?) must-infer
|
||||
|
@ -60,3 +62,17 @@ namespaces ;
|
|||
10 read length
|
||||
] with-file-reader
|
||||
] unit-test
|
||||
|
||||
USE: debugger.threads
|
||||
|
||||
[ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
|
||||
|
||||
[ ] [ "test-quux.txt" temp-file delete-file ] unit-test
|
||||
|
||||
[ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
|
||||
|
||||
[ ] [ "test-quux.txt" "quux-test.txt" [ temp-file ] bi@ move-file ] unit-test
|
||||
|
||||
[ t ] [ "quux-test.txt" temp-file exists? ] unit-test
|
||||
|
||||
[ ] [ "quux-test.txt" temp-file delete-file ] unit-test
|
||||
|
|
Loading…
Reference in New Issue