Improved tools.test
parent
d9338b1cd2
commit
8a4db99029
|
@ -3,7 +3,7 @@
|
||||||
USING: namespaces arrays prettyprint sequences kernel
|
USING: namespaces arrays prettyprint sequences kernel
|
||||||
vectors quotations words parser assocs combinators
|
vectors quotations words parser assocs combinators
|
||||||
continuations debugger io io.files vocabs tools.time
|
continuations debugger io io.files vocabs tools.time
|
||||||
vocabs.loader source-files compiler.units ;
|
vocabs.loader source-files compiler.units inspector ;
|
||||||
IN: tools.test
|
IN: tools.test
|
||||||
|
|
||||||
SYMBOL: failures
|
SYMBOL: failures
|
||||||
|
@ -30,9 +30,17 @@ SYMBOL: this-test
|
||||||
|
|
||||||
TUPLE: expected-error ;
|
TUPLE: expected-error ;
|
||||||
|
|
||||||
: unit-test-fails ( quot -- )
|
M: expected-error summary
|
||||||
[ f ] append [ [ drop t ] recover ] curry
|
drop
|
||||||
[ t ] swap unit-test ;
|
"The unit test expected the quotation to throw an error" ;
|
||||||
|
|
||||||
|
: must-fail-with ( quot test -- )
|
||||||
|
>r [ expected-error construct-empty throw ] compose r>
|
||||||
|
[ recover ] 2curry
|
||||||
|
[ ] swap unit-test ;
|
||||||
|
|
||||||
|
: must-fail ( quot -- )
|
||||||
|
[ drop t ] must-fail-with ;
|
||||||
|
|
||||||
: run-test ( path -- failures )
|
: run-test ( path -- failures )
|
||||||
[ "temporary" forget-vocab ] with-compilation-unit
|
[ "temporary" forget-vocab ] with-compilation-unit
|
||||||
|
|
Loading…
Reference in New Issue