tools.test: adding with-test-file and with-test-directory.
These provide unique temp files (and directories) that are automatically cleaned up when the quotation exits. Mostly this allows us to simplify some of our test files.locals-and-roots
parent
2ea3e304cf
commit
dd3189ecb6
|
@ -2,11 +2,12 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays assocs combinators command-line
|
||||
compiler.units continuations debugger effects fry
|
||||
generalizations io kernel lexer locals macros namespaces parser
|
||||
prettyprint quotations sequences sequences.generalizations
|
||||
source-files source-files.errors source-files.errors.debugger
|
||||
splitting stack-checker summary tools.errors unicode vocabs
|
||||
vocabs.files vocabs.metadata vocabs.parser words ;
|
||||
generalizations io io.files.temp io.files.unique kernel lexer
|
||||
locals macros namespaces parser prettyprint quotations sequences
|
||||
sequences.generalizations source-files source-files.errors
|
||||
source-files.errors.debugger splitting stack-checker summary
|
||||
tools.errors unicode vocabs vocabs.files vocabs.metadata
|
||||
vocabs.parser words ;
|
||||
FROM: vocabs.hierarchy => load ;
|
||||
IN: tools.test
|
||||
|
||||
|
@ -157,6 +158,12 @@ SYMBOL: forget-tests?
|
|||
|
||||
PRIVATE>
|
||||
|
||||
: with-test-file ( ..a quot: ( ..a path -- ..b ) -- ..b )
|
||||
'[ "" "" _ cleanup-unique-file ] with-temp-directory ; inline
|
||||
|
||||
: with-test-directory ( ..a quot: ( ..a -- ..b ) -- ..b )
|
||||
[ cleanup-unique-directory ] with-temp-directory ; inline
|
||||
|
||||
TEST: unit-test
|
||||
TEST: must-infer-as
|
||||
TEST: must-infer
|
||||
|
|
Loading…
Reference in New Issue