-USING: accessors alien.syntax continuations debugger kernel
+USING: accessors alien.syntax continuations debugger kernel literals
namespaces tools.test ;
IN: debugger.tests
{ f } [ { "A" "B" } vm-error? ] unit-test
{ } [
-T{ test-failure
- { error
- {
- "kernel-error"
- 10
- {
- B{
- 88 73 110 112 117 116 69 110 97 98 108 101 0
- }
- B{
- 88 73 110 112 117 116 69 110 97 98 108 101
- 64 56 0
- }
- B{
- 95 88 73 110 112 117 116 69 110 97 98 108
- 101 64 56 0
- }
- B{
- 64 88 73 110 112 117 116 69 110 97 98 108
- 101 64 56 0
- }
- }
- DLL" xinput1_3.dll"
- }
- }
- { asset { "Unit Test" [ ] [ dup ] } }
- { path "resource:basis/game/input/input-tests.factor" }
- { line# 6 }
- { continuation f }
-} error.
+ T{ test-failure
+ { error
+ {
+ "kernel-error"
+ 10
+ {
+ B{
+ 88 73 110 112 117 116 69 110 97 98 108 101 0
+ }
+ B{
+ 88 73 110 112 117 116 69 110 97 98 108 101
+ 64 56 0
+ }
+ B{
+ 95 88 73 110 112 117 116 69 110 97 98 108
+ 101 64 56 0
+ }
+ B{
+ 64 88 73 110 112 117 116 69 110 97 98 108
+ 101 64 56 0
+ }
+ }
+ DLL" xinput1_3.dll"
+ }
+ }
+ { asset { "Unit Test" [ ] [ dup ] } }
+ { path "resource:basis/game/input/input-tests.factor" }
+ { line# 6 }
+ { continuation $[ current-continuation ] }
+ } error.
] unit-test
{ "foo" { 1 2 3 "foo" } } [
IN: tools.test.tests
-USING: tools.test tools.test.private namespaces kernel sequences ;
+USING: continuations debugger io.streams.string kernel namespaces
+sequences tools.test tools.test.private ;
{ 1 } [
[
[ "OOPS" ] must-fail
] fake-unit-test length
] unit-test
+
+: create-test-failure ( -- error )
+ [ "hello" throw ] [
+ f "path" 25 error-continuation get test-failure boa
+ ] recover ;
+
+! Just verifies that the presented output contains a callstack.
+{ t } [
+ create-test-failure [ error. ] with-string-writer
+ "OBJ-CURRENT-THREAD" swap subseq?
+] unit-test
[ error-location print nl ]
[ asset>> [ experiment. nl ] when* ]
[ error>> error. ]
- [ continuation>> traceback-link. ]
+ [ continuation>> call>> callstack. ]
} cleave ;
: :test-failures ( -- ) test-failures get errors. ;