Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2008-02-07 18:55:17 -06:00
commit 3883dca17e
5 changed files with 26 additions and 35 deletions

View File

@ -124,11 +124,6 @@ HELP: refresh
{ $values { "prefix" string } }
{ $description "Reloads source files and documentation belonging to loaded vocabularies whose names are prefixed by " { $snippet "prefix" } " which have been modified on disk." } ;
HELP: require-all-error
{ $values { "vocabs" "a sequence of vocabularies" } }
{ $description "Throws a " { $link require-all-error } "." }
{ $error-description "Thrown by " { $link require-all } " if one or more vocabulary failed to load." } ;
HELP: refresh-all
{ $description "Reloads source files and documentation for all loaded vocabularies which have been modified on disk." } ;

View File

@ -160,37 +160,25 @@ SYMBOL: load-help?
drop ;
! third "Traceback" swap write-object ;
TUPLE: require-all-error vocabs ;
: load-failures. ( failures -- )
[ load-error. nl ] each ;
: require-all-error ( vocabs -- )
[ vocab-name ] map
\ require-all-error construct-boa throw ;
M: require-all-error summary
drop "The require-all operation failed" ;
: require-all ( vocabs -- )
dup length 1 = [ first require ] [
: require-all ( vocabs -- failures )
[
[
[
[
[ require ]
[ error-continuation get 3array , ]
recover
] each
] { } make
dup empty? [ drop ] [
dup [ load-error. nl ] each
keys require-all-error
] if
] with-compiler-errors
] if ;
[ require ]
[ error-continuation get 3array , ]
recover
] each
] { } make
] with-compiler-errors ;
: do-refresh ( modified-sources modified-docs -- )
2dup
[ f swap set-vocab-docs-loaded? ] each
[ f swap set-vocab-source-loaded? ] each
append prune require-all ;
append prune require-all load-failures. ;
: refresh ( prefix -- ) to-refresh do-refresh ;

View File

@ -132,11 +132,17 @@ MEMO: all-vocabs-seq ( -- seq )
{ [ t ] [ f ] }
} cond nip ;
: load-everything ( -- )
: filter-dangerous ( seq -- seq' )
[ vocab-name dangerous? not ] subset ;
: try-everything ( -- failures )
all-vocabs-seq
[ vocab-name dangerous? not ] subset
filter-dangerous
require-all ;
: load-everything ( -- )
try-everything drop ;
: unrooted-child-vocabs ( prefix -- seq )
dup empty? [ CHAR: . add ] unless
vocabs
@ -155,7 +161,9 @@ MEMO: all-vocabs-seq ( -- seq )
: load-children ( prefix -- )
all-child-vocabs values concat
require-all ;
filter-dangerous
require-all
load-failures. ;
: vocab-status-string ( vocab -- string )
{

View File

@ -29,7 +29,7 @@ $nl
{ $subsection run-tests }
{ $subsection run-all-tests }
"The following word prints failures:"
{ $subsection failures. } ;
{ $subsection test-failures. } ;
ARTICLE: "tools.test" "Unit testing"
"A unit test is a piece of code which starts with known input values, then compares the output of a word with an expected output, where the expected output is defined by the word's contract."

View File

@ -80,7 +80,7 @@ M: expected-error summary
dup first print-error
"Traceback" swap third write-object ;
: failures. ( assoc -- )
: test-failures. ( assoc -- )
dup [
nl
dup empty? [
@ -104,10 +104,10 @@ M: expected-error summary
] if ;
: test ( prefix -- )
run-tests failures. ;
run-tests test-failures. ;
: run-all-tests ( prefix -- failures )
"" run-tests ;
: test-all ( -- )
run-all-tests failures. ;
run-all-tests test-failures. ;