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.
USING: accessors arrays assocs combinators compiler.units
continuations debugger effects fry generalizations io io.files
@ -118,12 +118,21 @@ PRIVATE>
'[ _ run-file ] [ file-failure ] recover
] with-variable ;
SYMBOL: forget-tests?
<PRIVATE
: forget-tests ( files -- )
forget-tests? get
[ [ [ forget-source ] each ] with-compilation-unit ] [ drop ] if ;
: run-vocab-tests ( vocab -- )
vocab dup [
dup source-loaded?>> [
vocab-tests [ run-test-file ] each
vocab-tests
[ [ run-test-file ] each ]
[ forget-tests ]
bi
] [ drop ] if
] [ drop ] if ;

View File

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