Merge branch 'master' of git://factorcode.org/git/factor
commit
3883dca17e
|
@ -124,11 +124,6 @@ HELP: refresh
|
||||||
{ $values { "prefix" string } }
|
{ $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." } ;
|
{ $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
|
HELP: refresh-all
|
||||||
{ $description "Reloads source files and documentation for all loaded vocabularies which have been modified on disk." } ;
|
{ $description "Reloads source files and documentation for all loaded vocabularies which have been modified on disk." } ;
|
||||||
|
|
||||||
|
|
|
@ -160,17 +160,10 @@ SYMBOL: load-help?
|
||||||
drop ;
|
drop ;
|
||||||
! third "Traceback" swap write-object ;
|
! third "Traceback" swap write-object ;
|
||||||
|
|
||||||
TUPLE: require-all-error vocabs ;
|
: load-failures. ( failures -- )
|
||||||
|
[ load-error. nl ] each ;
|
||||||
|
|
||||||
: require-all-error ( vocabs -- )
|
: require-all ( vocabs -- failures )
|
||||||
[ 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 ] [
|
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
@ -179,18 +172,13 @@ M: require-all-error summary
|
||||||
recover
|
recover
|
||||||
] each
|
] each
|
||||||
] { } make
|
] { } make
|
||||||
dup empty? [ drop ] [
|
] with-compiler-errors ;
|
||||||
dup [ load-error. nl ] each
|
|
||||||
keys require-all-error
|
|
||||||
] if
|
|
||||||
] with-compiler-errors
|
|
||||||
] if ;
|
|
||||||
|
|
||||||
: do-refresh ( modified-sources modified-docs -- )
|
: do-refresh ( modified-sources modified-docs -- )
|
||||||
2dup
|
2dup
|
||||||
[ f swap set-vocab-docs-loaded? ] each
|
[ f swap set-vocab-docs-loaded? ] each
|
||||||
[ f swap set-vocab-source-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 ;
|
: refresh ( prefix -- ) to-refresh do-refresh ;
|
||||||
|
|
||||||
|
|
|
@ -132,11 +132,17 @@ MEMO: all-vocabs-seq ( -- seq )
|
||||||
{ [ t ] [ f ] }
|
{ [ t ] [ f ] }
|
||||||
} cond nip ;
|
} cond nip ;
|
||||||
|
|
||||||
: load-everything ( -- )
|
: filter-dangerous ( seq -- seq' )
|
||||||
|
[ vocab-name dangerous? not ] subset ;
|
||||||
|
|
||||||
|
: try-everything ( -- failures )
|
||||||
all-vocabs-seq
|
all-vocabs-seq
|
||||||
[ vocab-name dangerous? not ] subset
|
filter-dangerous
|
||||||
require-all ;
|
require-all ;
|
||||||
|
|
||||||
|
: load-everything ( -- )
|
||||||
|
try-everything drop ;
|
||||||
|
|
||||||
: unrooted-child-vocabs ( prefix -- seq )
|
: unrooted-child-vocabs ( prefix -- seq )
|
||||||
dup empty? [ CHAR: . add ] unless
|
dup empty? [ CHAR: . add ] unless
|
||||||
vocabs
|
vocabs
|
||||||
|
@ -155,7 +161,9 @@ MEMO: all-vocabs-seq ( -- seq )
|
||||||
|
|
||||||
: load-children ( prefix -- )
|
: load-children ( prefix -- )
|
||||||
all-child-vocabs values concat
|
all-child-vocabs values concat
|
||||||
require-all ;
|
filter-dangerous
|
||||||
|
require-all
|
||||||
|
load-failures. ;
|
||||||
|
|
||||||
: vocab-status-string ( vocab -- string )
|
: vocab-status-string ( vocab -- string )
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ $nl
|
||||||
{ $subsection run-tests }
|
{ $subsection run-tests }
|
||||||
{ $subsection run-all-tests }
|
{ $subsection run-all-tests }
|
||||||
"The following word prints failures:"
|
"The following word prints failures:"
|
||||||
{ $subsection failures. } ;
|
{ $subsection test-failures. } ;
|
||||||
|
|
||||||
ARTICLE: "tools.test" "Unit testing"
|
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."
|
"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."
|
||||||
|
|
|
@ -80,7 +80,7 @@ M: expected-error summary
|
||||||
dup first print-error
|
dup first print-error
|
||||||
"Traceback" swap third write-object ;
|
"Traceback" swap third write-object ;
|
||||||
|
|
||||||
: failures. ( assoc -- )
|
: test-failures. ( assoc -- )
|
||||||
dup [
|
dup [
|
||||||
nl
|
nl
|
||||||
dup empty? [
|
dup empty? [
|
||||||
|
@ -104,10 +104,10 @@ M: expected-error summary
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: test ( prefix -- )
|
: test ( prefix -- )
|
||||||
run-tests failures. ;
|
run-tests test-failures. ;
|
||||||
|
|
||||||
: run-all-tests ( prefix -- failures )
|
: run-all-tests ( prefix -- failures )
|
||||||
"" run-tests ;
|
"" run-tests ;
|
||||||
|
|
||||||
: test-all ( -- )
|
: test-all ( -- )
|
||||||
run-all-tests failures. ;
|
run-all-tests test-failures. ;
|
||||||
|
|
Loading…
Reference in New Issue