Mercurial > hg > octave-nkf
annotate test/test_eval-catch.m @ 7540:3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Thu, 28 Feb 2008 02:41:19 -0500 |
parents | a1dbe9d80eee |
children | 3092dd54ad95 |
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/eval-catch/eval-catch-1.m | |
22 %!test | |
23 %! eval ("clear a; a;", ""); | |
24 | |
25 %% test/octave.test/eval-catch/eval-catch-2.m | |
26 %!test | |
27 %! eval ("", "error('Shouldn't get here');"); | |
28 | |
29 %% test/octave.test/eval-catch/eval-catch-3.m | |
30 %!test | |
31 %! eval ("clear a; a; x = 0;", "x = 1;"); | |
32 %! assert (x, 1); | |
33 | |
5775 | 34 %% FIXME This is redundant with the changes to the above |
5590 | 35 %% test/octave.test/eval-catch/eval-catch-4.m |
36 | |
37 %% test/octave.test/eval-catch/eval-catch-5.m | |
38 %!test | |
39 %! eval ("clear a; a; str = '';", "str=lasterr;"); | |
40 %! assert(lasterr()(1:20),"error: `a' undefined"); | |
41 %! assert(str(1:20),"error: `a' undefined"); | |
42 | |
43 %% test/octave.test/eval-catch/eval-catch-6.m | |
44 %!test | |
45 %! eval ("error (\"user-defined error\"); str = '';", "str = lasterr;"); | |
46 %! assert(lasterr()(1:25),"error: user-defined error"); | |
47 %! assert(str(1:25),"error: user-defined error"); | |
48 | |
49 %% test/octave.test/eval-catch/eval-catch-7.m | |
50 %!function ms = mangle (s) | |
51 %! ## 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
|
52 %! ms = cstrcat ("<", s, ">"); |
5590 | 53 %!test |
54 %! eval ("clear a; a; str='';", "str = mangle (lasterr);"); | |
55 %! assert(mangle(lasterr)(1:21),"<error: `a' undefined"); | |
56 %! assert(str(1:21),"<error: `a' undefined"); | |
57 | |
58 %% test/octave.test/eval-catch/eval-catch-8.m | |
59 %!test | |
60 %! eval ("eval (\"clear a; a;str1='';\", \"str1=lasterr;\"); clear b; b; str2='';", | |
61 %! "str2 = lasterr;"); | |
62 %! assert(str1(1:20),"error: `a' undefined"); | |
63 %! assert(str2(1:20),"error: `b' undefined"); | |
64 | |
65 %% test/octave.test/eval-catch/eval-catch-9.m | |
66 %!test | |
67 %! eval ("clear a; a; str1='';", | |
68 %! "eval (\"clear b; b; str2='';\", \"str2=lasterr;\"); str1=lasterr;"); | |
69 %! assert(str1(1:20),"error: `b' undefined"); | |
70 %! assert(str2(1:20),"error: `b' undefined"); | |
71 | |
72 %% test/octave.test/eval-catch/eval-catch-10.m | |
73 %!test | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
74 %! eval ("eval (\"clear a; a; str='';\",\"error (cstrcat (\\\"rethrow: \\\", lasterr));str='';\");", |
5590 | 75 %! "str=lasterr;"); |
76 %! assert(str(1:36),"error: rethrow: error: `a' undefined"); |