Refactor tools.test
parent
f3c8bd266b
commit
7534d84d27
|
@ -61,35 +61,42 @@ M: expected-error summary
|
||||||
dup first print-error
|
dup first print-error
|
||||||
"Traceback" swap third write-object ;
|
"Traceback" swap third write-object ;
|
||||||
|
|
||||||
: failures. ( path failures -- )
|
: failures. ( assoc -- )
|
||||||
"Failing tests in " write swap <pathname> .
|
dup [
|
||||||
[ nl failure. nl ] each ;
|
|
||||||
|
|
||||||
: run-tests ( seq -- )
|
|
||||||
dup empty? [ drop "==== NOTHING TO TEST" print ] [
|
|
||||||
[ dup run-test ] { } map>assoc
|
|
||||||
[ second empty? not ] subset
|
|
||||||
nl
|
nl
|
||||||
dup empty? [
|
dup empty? [
|
||||||
drop
|
drop
|
||||||
"==== ALL TESTS PASSED" print
|
"==== ALL TESTS PASSED" print
|
||||||
] [
|
] [
|
||||||
"==== FAILING TESTS:" print
|
"==== FAILING TESTS:" print
|
||||||
[ nl failures. ] assoc-each
|
[
|
||||||
|
nl
|
||||||
|
"Failing tests in " write swap <pathname> .
|
||||||
|
[ nl failure. nl ] each
|
||||||
|
] assoc-each
|
||||||
] if
|
] if
|
||||||
|
] [
|
||||||
|
drop "==== NOTHING TO TEST" print
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: run-vocab-tests ( vocabs -- )
|
: run-vocab-tests ( vocabs -- failures )
|
||||||
[ vocab-tests-path ] map
|
dup empty? [ f ] [
|
||||||
[ dup [ ?resource-path exists? ] when ] subset
|
[ dup run-test ] { } map>assoc
|
||||||
run-tests ;
|
[ second empty? not ] subset
|
||||||
|
] if ;
|
||||||
|
|
||||||
: test ( prefix -- )
|
: run-tests ( prefix -- failures )
|
||||||
child-vocabs
|
child-vocabs
|
||||||
[ vocab-source-loaded? ] subset
|
[ vocab-source-loaded? ] subset
|
||||||
|
[ vocab-tests-path ] map
|
||||||
|
[ dup [ ?resource-path exists? ] when ] subset
|
||||||
run-vocab-tests ;
|
run-vocab-tests ;
|
||||||
|
|
||||||
: test-all ( -- ) "" test ;
|
: test ( prefix -- )
|
||||||
|
run-tests failures. ;
|
||||||
|
|
||||||
: test-changes ( -- )
|
: run-all-tests ( prefix -- failures )
|
||||||
"" to-refresh dupd do-refresh run-vocab-tests ;
|
"" run-tests ;
|
||||||
|
|
||||||
|
: test-all ( -- )
|
||||||
|
run-all-tests failures. ;
|
||||||
|
|
Loading…
Reference in New Issue