comparison test/test_try.m @ 5590:1ad66ea35fe5

[project @ 2006-01-06 00:24:05 by jwe]
author jwe
date Fri, 06 Jan 2006 00:24:06 +0000
parents
children 93c65f2a5668
comparison
equal deleted inserted replaced
5589:f812a0680d05 5590:1ad66ea35fe5
1 %% Automatically generated from DejaGNU files
2
3 %% test/octave.test/try/try-1.m
4 %!test
5 %! try
6 %! catch
7 %! error("Shoudn't get here");
8 %! end_try_catch
9
10 %% test/octave.test/try/try-2.m
11 %!test
12 %! try
13 %! clear a
14 %! a;
15 %! catch
16 %! end_try_catch
17 %! a = 1;
18 %! assert(a,1);
19
20 %% test/octave.test/try/try-3.m
21 %!test
22 %! clear x;
23 %! try
24 %! clear a
25 %! a;
26 %! x = 1;
27 %! catch
28 %! end_try_catch
29 %! a = 2;
30 %! assert(!exist('x'))
31 %! assert(a,2)
32
33 %% test/octave.test/try/try-4.m
34 %!test
35 %! try
36 %! clear a
37 %! a;
38 %! catch
39 %! x = 1;
40 %! end_try_catch
41 %! assert(exist('x'))
42
43 %% test/octave.test/try/try-5.m
44 %!test
45 %! try
46 %! clear a;
47 %! a;
48 %! error("Shoudn't get here");
49 %! catch
50 %! assert (strcmp(lasterr()(1:20), "error: `a' undefined"))
51 %! end_try_catch
52 %! assert (strcmp(lasterr()(1:20), "error: `a' undefined"))
53
54 %% test/octave.test/try/try-6.m
55 %!test
56 %! try
57 %! error ("user-defined error")
58 %! catch
59 %! assert(lasterr,"error: user-defined error\n");
60 %! end_try_catch
61
62 %% test/octave.test/try/try-7.m
63 %!function ms = mangle (s)
64 %! ## Wrap angle brackets around S.
65 %! ms = strcat ("<", s, ">");
66 %!test
67 %! try
68 %! clear a
69 %! a;
70 %! error("Shoudn't get here");
71 %! catch
72 %! assert(strcmp(mangle (lasterr)(1:21),"<error: `a' undefined"))
73 %! end_try_catch
74
75
76 %% test/octave.test/try/try-8.m
77 %!test
78 %! try
79 %! try
80 %! clear a
81 %! a;
82 %! error("Shoudn't get here");
83 %! catch
84 %! assert(strcmp(lasterr()(1:20), "error: `a' undefined"))
85 %! end_try_catch
86 %! clear b
87 %! b;
88 %! error("Shoudn't get here");
89 %! catch
90 %! assert(strcmp(lasterr()(1:20), "error: `b' undefined"))
91 %! end_try_catch
92
93 %% test/octave.test/try/try-9.m
94 %!test
95 %! try
96 %! clear a
97 %! a;
98 %! error("Shoudn't get here");
99 %! catch
100 %! try
101 %! assert(strcmp(lasterr()(1:20), "error: `a' undefined"))
102 %! clear b
103 %! b;
104 %! error("Shoudn't get here");
105 %! catch
106 %! assert(strcmp(lasterr()(1:20), "error: `b' undefined"))
107 %! end_try_catch
108 %! end_try_catch
109
110 %% test/octave.test/try/try-10.m
111 %!test
112 %! try
113 %! try
114 %! clear a
115 %! a;
116 %! error("Shoudn't get here");
117 %! catch
118 %! error(strcat("rethrow: ",lasterr));
119 %! end_try_catch
120 %! catch
121 %! assert(strcmp(lasterr()(1:36), "error: rethrow: error: `a' undefined"))
122 %! end_try_catch
123