]> gitweb.factorcode.org Git - factor.git/commitdiff
mason.test: forget test vocabs right after each test, instead of at the end
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 12 Apr 2010 21:45:43 +0000 (14:45 -0700)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 12 Apr 2010 21:45:43 +0000 (14:45 -0700)
basis/tools/test/test.factor
extra/mason/test/test.factor

index 8dda4fe16c484eb7b6ddc969609c2b572e546105..f3f53e43b71bab58470eea9f895850760096b61b 100644 (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 ;
 
index e99f76c8c471863893e603629742ffbf3fe9ef38..8e248e861b841443324a5472ad10822bb0a78e8f 100644 (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