Print unit test failures better

db4
Slava Pestov 2009-04-13 14:40:55 -05:00
parent 2abdf4c138
commit 73a2e81953
2 changed files with 9 additions and 8 deletions

View File

@ -214,14 +214,13 @@ M: condition error-help error>> error-help ;
M: assert summary drop "Assertion failed" ;
M: assert error.
"Assertion failed" print
M: assert-sequence summary drop "Assertion failed" ;
M: assert-sequence error.
standard-table-style [
15 length-limit set
5 line-limit set
[ expect>> [ [ "Expect:" write ] with-cell pprint-cell ] with-row ]
[ got>> [ [ "Got:" write ] with-cell pprint-cell ] with-row ] bi
] tabular-output nl ;
[ "=== Expected:" print expected>> stack. ]
[ "=== Got:" print got>> stack. ] bi
] tabular-output ;
M: immutable summary drop "Sequence is immutable" ;

View File

@ -568,8 +568,10 @@ M: sequence <=>
2dup [ length ] bi@ =
[ mismatch not ] [ 2drop f ] if ; inline
ERROR: assert-sequence got expected ;
: assert-sequence= ( a b -- )
2dup sequence= [ 2drop ] [ assert ] if ;
2dup sequence= [ 2drop ] [ assert-sequence ] if ;
: sequence-hashcode-step ( oldhash newpart -- newhash )
>fixnum swap [