comparison test/octave.test/try/try.exp @ 4699:5e2c68946f30

[project @ 2004-01-20 23:04:46 by jwe]
author jwe
date Tue, 20 Jan 2004 23:04:47 +0000
parents 6a1e6e87f143
children
comparison
equal deleted inserted replaced
4698:737fd5c0ae06 4699:5e2c68946f30
16 ## execute catch-clause 16 ## execute catch-clause
17 set test try-4 17 set test try-4
18 set prog_output "^ans = 1" 18 set prog_output "^ans = 1"
19 do_test try-4.m 19 do_test try-4.m
20 20
21 ## define __error_text__ *only* within catch-clause 21 ## lasterr works in and out of the catch string.
22 set test try-5 22 set test try-5
23 set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = $" 23 set prog_output "ans = error: `a' undefined.*\n\nans = error: `a' undefined"
24 do_test try-5.m 24 do_test try-5.m
25 25
26 ## throw user-defined error 26 ## throw user-defined error
27 set test try-6 27 set test try-6
28 set prog_output "__error_text__ = user-defined error\n" 28 set prog_output "ans = error: user-defined error\n"
29 do_test try-6.m 29 do_test try-6.m
30 30
31 ## pass __error_text__ to user-defined subroutine 31 ## pass lasterr to user-defined subroutine
32 set test try-7 32 set test try-7
33 set prog_output "^ans = <`a' undefined.*\n>" 33 set prog_output "^ans = <error: `a' undefined.*\n>"
34 do_test try-7.m 34 do_test try-7.m
35 35
36 ## handle nested try-catch-block: try nested in try 36 ## handle nested try-catch-block: try nested in try
37 set test try-8 37 set test try-8
38 set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = `b' undefined.*\n$" 38 set prog_output "ans = error: `a' undefined.*\n\nans = error: `b' undefined.*\n$"
39 do_test try-8.m 39 do_test try-8.m
40 40
41 ## handle nested try-catch-block: try nested in catch 41 ## handle nested try-catch-block: try nested in catch
42 set test try-9 42 set test try-9
43 set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = `b' undefined.*\n$" 43 set prog_output "ans = error: `b' undefined.*\n\nans = error: `b' undefined.*\n$"
44 setup_xfail *-*-*
45 do_test try-9.m 44 do_test try-9.m
46 45
47 ## re-throw an error 46 ## re-throw an error
48 set test try-10 47 set test try-10
49 set prog_output "__error_text__ = rethrow: `a' undefined.*\n" 48 set prog_output "ans = error: rethrow: error: `a' undefined.*\n"
50 setup_xfail *-*-*
51 do_test try-10.m 49 do_test try-10.m