7016
|
1 ## Copyright (C) 2007 John W. Eaton |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
|
18 |
5590
|
19 %% Automatically generated from DejaGNU files |
|
20 |
|
21 %% test/octave.test/try/try-1.m |
|
22 %!test |
|
23 %! try |
|
24 %! catch |
|
25 %! error("Shoudn't get here"); |
|
26 %! end_try_catch |
|
27 |
|
28 %% test/octave.test/try/try-2.m |
|
29 %!test |
|
30 %! try |
|
31 %! clear a |
|
32 %! a; |
|
33 %! catch |
|
34 %! end_try_catch |
|
35 %! a = 1; |
|
36 %! assert(a,1); |
|
37 |
|
38 %% test/octave.test/try/try-3.m |
|
39 %!test |
|
40 %! clear x; |
|
41 %! try |
|
42 %! clear a |
|
43 %! a; |
|
44 %! x = 1; |
|
45 %! catch |
|
46 %! end_try_catch |
|
47 %! a = 2; |
|
48 %! assert(!exist('x')) |
|
49 %! assert(a,2) |
|
50 |
|
51 %% test/octave.test/try/try-4.m |
|
52 %!test |
|
53 %! try |
|
54 %! clear a |
|
55 %! a; |
|
56 %! catch |
|
57 %! x = 1; |
|
58 %! end_try_catch |
|
59 %! assert(exist('x')) |
|
60 |
|
61 %% test/octave.test/try/try-5.m |
|
62 %!test |
|
63 %! try |
|
64 %! clear a; |
|
65 %! a; |
|
66 %! error("Shoudn't get here"); |
|
67 %! catch |
|
68 %! assert (strcmp(lasterr()(1:20), "error: `a' undefined")) |
|
69 %! end_try_catch |
|
70 %! assert (strcmp(lasterr()(1:20), "error: `a' undefined")) |
|
71 |
|
72 %% test/octave.test/try/try-6.m |
|
73 %!test |
|
74 %! try |
|
75 %! error ("user-defined error") |
|
76 %! catch |
|
77 %! assert(lasterr,"error: user-defined error\n"); |
|
78 %! end_try_catch |
|
79 |
|
80 %% test/octave.test/try/try-7.m |
|
81 %!function ms = mangle (s) |
|
82 %! ## Wrap angle brackets around S. |
|
83 %! ms = strcat ("<", s, ">"); |
|
84 %!test |
|
85 %! try |
|
86 %! clear a |
|
87 %! a; |
|
88 %! error("Shoudn't get here"); |
|
89 %! catch |
|
90 %! assert(strcmp(mangle (lasterr)(1:21),"<error: `a' undefined")) |
|
91 %! end_try_catch |
|
92 |
|
93 |
|
94 %% test/octave.test/try/try-8.m |
|
95 %!test |
|
96 %! try |
|
97 %! try |
|
98 %! clear a |
|
99 %! a; |
|
100 %! error("Shoudn't get here"); |
|
101 %! catch |
|
102 %! assert(strcmp(lasterr()(1:20), "error: `a' undefined")) |
|
103 %! end_try_catch |
|
104 %! clear b |
|
105 %! b; |
|
106 %! error("Shoudn't get here"); |
|
107 %! catch |
|
108 %! assert(strcmp(lasterr()(1:20), "error: `b' undefined")) |
|
109 %! end_try_catch |
|
110 |
|
111 %% test/octave.test/try/try-9.m |
|
112 %!test |
|
113 %! try |
|
114 %! clear a |
|
115 %! a; |
|
116 %! error("Shoudn't get here"); |
|
117 %! catch |
|
118 %! try |
|
119 %! assert(strcmp(lasterr()(1:20), "error: `a' undefined")) |
|
120 %! clear b |
|
121 %! b; |
|
122 %! error("Shoudn't get here"); |
|
123 %! catch |
|
124 %! assert(strcmp(lasterr()(1:20), "error: `b' undefined")) |
|
125 %! end_try_catch |
|
126 %! end_try_catch |
|
127 |
|
128 %% test/octave.test/try/try-10.m |
|
129 %!test |
|
130 %! try |
|
131 %! try |
|
132 %! clear a |
|
133 %! a; |
|
134 %! error("Shoudn't get here"); |
|
135 %! catch |
|
136 %! error(strcat("rethrow: ",lasterr)); |
|
137 %! end_try_catch |
|
138 %! catch |
|
139 %! assert(strcmp(lasterr()(1:36), "error: rethrow: error: `a' undefined")) |
|
140 %! end_try_catch |
|
141 |