diff options
Diffstat (limited to 'tests/i/caught-errors/program.cps')
| -rw-r--r-- | tests/i/caught-errors/program.cps | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/i/caught-errors/program.cps b/tests/i/caught-errors/program.cps new file mode 100644 index 0000000..919696b --- /dev/null +++ b/tests/i/caught-errors/program.cps @@ -0,0 +1,31 @@ +DECLARE X : INTEGER +DECLARE Values : ARRAY[1:1] OF INTEGER +TYPE IntPtr = ^INTEGER +DECLARE P : IntPtr +X <- 0 +TRY + OUTPUT 4 DIV X +CATCH + OUTPUT "division caught" +ENDTRY +TRY + OUTPUT Values[2] +CATCH + OUTPUT "bounds caught" +ENDTRY +TRY + OUTPUT P^ +CATCH + OUTPUT "pointer caught" +ENDTRY +TRY + CLOSEFILE "closed.txt" +CATCH + OUTPUT "file caught" +ENDTRY +TRY + THROW +CATCH + OUTPUT "throw caught" +ENDTRY +OUTPUT "alive" |
