Improved tools.test

db4
Slava Pestov 2008-02-06 13:15:15 -06:00
parent d9338b1cd2
commit 8a4db99029
1 changed files with 12 additions and 4 deletions

View File

@ -3,7 +3,7 @@
USING: namespaces arrays prettyprint sequences kernel
vectors quotations words parser assocs combinators
continuations debugger io io.files vocabs tools.time
vocabs.loader source-files compiler.units ;
vocabs.loader source-files compiler.units inspector ;
IN: tools.test
SYMBOL: failures
@ -30,9 +30,17 @@ SYMBOL: this-test
TUPLE: expected-error ;
: unit-test-fails ( quot -- )
[ f ] append [ [ drop t ] recover ] curry
[ t ] swap unit-test ;
M: expected-error summary
drop
"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 )
[ "temporary" forget-vocab ] with-compilation-unit