mason.test: forget test vocabs right after each test, instead of at the end

release
Slava Pestov 2010-04-12 14:45:43 -07:00
parent 1434a305c8
commit a7ee58dc83
2 changed files with 17 additions and 15 deletions

View File

@ -1,4 +1,4 @@
! Copyright (C) 2003, 2009 Slava Pestov. ! Copyright (C) 2003, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs combinators compiler.units USING: accessors arrays assocs combinators compiler.units
continuations debugger effects fry generalizations io io.files continuations debugger effects fry generalizations io io.files
@ -118,12 +118,21 @@ PRIVATE>
'[ _ run-file ] [ file-failure ] recover '[ _ run-file ] [ file-failure ] recover
] with-variable ; ] with-variable ;
SYMBOL: forget-tests?
<PRIVATE <PRIVATE
: forget-tests ( files -- )
forget-tests? get
[ [ [ forget-source ] each ] with-compilation-unit ] [ drop ] if ;
: run-vocab-tests ( vocab -- ) : run-vocab-tests ( vocab -- )
vocab dup [ vocab dup [
dup source-loaded?>> [ dup source-loaded?>> [
vocab-tests [ run-test-file ] each vocab-tests
[ [ run-test-file ] each ]
[ forget-tests ]
bi
] [ drop ] if ] [ drop ] if
] [ drop ] if ; ] [ drop ] if ;

View File

@ -1,12 +1,11 @@
! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov. ! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs benchmark bootstrap.stage2 USING: accessors assocs benchmark bootstrap.stage2
compiler.errors source-files.errors generic help.html help.lint compiler.errors generic help.html help.lint io io.directories
io.directories io.encodings.utf8 io.files kernel mason.common io.encodings.utf8 io.files kernel locals mason.common
math namespaces prettyprint sequences sets sorting tools.test namespaces sequences sets sorting source-files.errors system
tools.time words system io tools.errors vocabs vocabs.files tools.errors tools.test tools.time vocabs.errors
vocabs.hierarchy vocabs.errors vocabs.refresh locals vocabs.hierarchy vocabs.refresh words ;
source-files compiler.units ;
IN: mason.test IN: mason.test
: do-load ( -- ) : do-load ( -- )
@ -28,17 +27,12 @@ M: method word-vocabulary "method-generic" word-prop word-vocabulary ;
errors details-file utf8 [ errors. ] with-file-writer ; errors details-file utf8 [ errors. ] with-file-writer ;
: do-tests ( -- ) : do-tests ( -- )
forget-tests? on
test-all test-failures get test-all test-failures get
test-all-vocabs-file test-all-vocabs-file
test-all-errors-file test-all-errors-file
do-step ; do-step ;
: cleanup-tests ( -- )
! Free up some code heap space
[
vocabs [ vocab-tests [ forget-source ] each ] each
] with-compilation-unit ;
: do-help-lint ( -- ) : do-help-lint ( -- )
help-lint-all lint-failures get values help-lint-all lint-failures get values
help-lint-vocabs-file help-lint-vocabs-file
@ -76,7 +70,6 @@ M: method word-vocabulary "method-generic" word-prop word-vocabulary ;
[ do-load ] benchmark load-time-file to-file [ do-load ] benchmark load-time-file to-file
[ generate-help ] benchmark html-help-time-file to-file [ generate-help ] benchmark html-help-time-file to-file
[ do-tests ] benchmark test-time-file to-file [ do-tests ] benchmark test-time-file to-file
cleanup-tests
[ do-help-lint ] benchmark help-lint-time-file to-file [ do-help-lint ] benchmark help-lint-time-file to-file
[ do-benchmarks ] benchmark benchmark-time-file to-file [ do-benchmarks ] benchmark benchmark-time-file to-file
do-compile-errors do-compile-errors