factor/library/test/errors.factor

31 lines
627 B
Factor
Raw Normal View History

2004-08-16 21:11:27 -04:00
IN: scratchpad
USE: errors
USE: kernel
USE: namespaces
USE: test
2004-11-25 20:37:05 -05:00
USE: lists
2004-11-25 23:14:17 -05:00
USE: parser
USE: stdio
2004-08-16 21:11:27 -04:00
[ f ] [ [ ] [ ] catch ] unit-test
[ 5 ] [ [ 5 throw ] [ ] catch ] unit-test
[ t ] [
[ "Hello" throw ] [ drop ] catch
global [ "error" get ] bind
"Hello" =
] unit-test
2004-11-25 20:37:05 -05:00
2004-11-25 23:14:17 -05:00
"!!! The following error is part of the test" print
[ ] [ [ 6 [ 12 [ "2 car" ] ] ] default-error-handler ] unit-test
"!!! The following error is part of the test" print
[ [ "2 car" ] parse ] [ default-error-handler ] catch
[ [ "\"\" { } vector-nth" ] parse ] [ type-check-error ] catch
[ "cons" ] [ [ 1 2 ] type type-error-name ] unit-test