Mercurial > hg > octave-nkf
annotate test/test_try.m @ 8575:f134925a1cfa
m-file implementation of help system
author | Soren Hauberg <soren@hauberg.org> |
---|---|
date | Thu, 22 Jan 2009 18:22:52 -0500 |
parents | 3092dd54ad95 |
children | eb63fbe60fab |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 2006, 2007 John W. Eaton |
7016 | 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 | |
7883
3092dd54ad95
fix expected output from lasterr in tests; fix fail tests in ismember.m
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
68 %! assert (strcmp(lasterr()(1:13), "`a' undefined")) |
5590 | 69 %! end_try_catch |
7883
3092dd54ad95
fix expected output from lasterr in tests; fix fail tests in ismember.m
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
70 %! assert (strcmp(lasterr()(1:13), "`a' undefined")) |
5590 | 71 |
72 %% test/octave.test/try/try-6.m | |
73 %!test | |
74 %! try | |
75 %! error ("user-defined error") | |
76 %! catch | |
7883
3092dd54ad95
fix expected output from lasterr in tests; fix fail tests in ismember.m
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
77 %! assert(lasterr,"user-defined error"); |
5590 | 78 %! end_try_catch |
79 | |
80 %% test/octave.test/try/try-7.m | |
81 %!function ms = mangle (s) | |
82 %! ## Wrap angle brackets around S. | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
83 %! ms = cstrcat ("<", s, ">"); |
5590 | 84 %!test |
85 %! try | |
86 %! clear a | |
87 %! a; | |
88 %! error("Shoudn't get here"); | |
89 %! catch | |
7883
3092dd54ad95
fix expected output from lasterr in tests; fix fail tests in ismember.m
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
90 %! assert(strcmp(mangle (lasterr)(1:14),"<`a' undefined")) |
5590 | 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 | |
7883
3092dd54ad95
fix expected output from lasterr in tests; fix fail tests in ismember.m
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
102 %! assert(strcmp(lasterr()(1:13), "`a' undefined")) |
5590 | 103 %! end_try_catch |
104 %! clear b | |
105 %! b; | |
106 %! error("Shoudn't get here"); | |
107 %! catch | |
7883
3092dd54ad95
fix expected output from lasterr in tests; fix fail tests in ismember.m
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
108 %! assert(strcmp(lasterr()(1:13), "`b' undefined")) |
5590 | 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 | |
7883
3092dd54ad95
fix expected output from lasterr in tests; fix fail tests in ismember.m
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
119 %! assert(strcmp(lasterr()(1:13), "`a' undefined")) |
5590 | 120 %! clear b |
121 %! b; | |
122 %! error("Shoudn't get here"); | |
123 %! catch | |
7883
3092dd54ad95
fix expected output from lasterr in tests; fix fail tests in ismember.m
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
124 %! assert(strcmp(lasterr()(1:13), "`b' undefined")) |
5590 | 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 | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
136 %! error(cstrcat("rethrow: ",lasterr)); |
5590 | 137 %! end_try_catch |
138 %! catch | |
7883
3092dd54ad95
fix expected output from lasterr in tests; fix fail tests in ismember.m
John W. Eaton <jwe@octave.org>
parents:
7540
diff
changeset
|
139 %! assert(strcmp(lasterr()(1:22), "rethrow: `a' undefined")) |
5590 | 140 %! end_try_catch |
141 |