Mercurial > octave-nkf
comparison test/eval-catch.tst @ 16030:1af8d21608b7
rename all test files in the test directory from test_X.m to X.tst
* Use - instead of _ for .tst file names. Fix all file lists in
module.mk and Makefile.am files.
* __run_test_suite__.m: Adapt to new naming convention.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 09 Feb 2013 21:35:55 -0500 |
parents | test/test_eval-catch.m@d174210ce1ec |
children | b1283d4c06c2 |
comparison
equal
deleted
inserted
replaced
16029:b8157404614f | 16030:1af8d21608b7 |
---|---|
1 ## Copyright (C) 2006-2012 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 | |
19 %% test/octave.test/eval-catch/eval-catch-1.m | |
20 %!test | |
21 %! eval ("clear a; a;", ""); | |
22 | |
23 %% test/octave.test/eval-catch/eval-catch-2.m | |
24 %!test | |
25 %! eval ("", "error ('Should not get here');"); | |
26 | |
27 %% test/octave.test/eval-catch/eval-catch-3.m | |
28 %!test | |
29 %! eval ("clear a; a; x = 0;", "x = 1;"); | |
30 %! assert (x, 1); | |
31 | |
32 %% test/octave.test/eval-catch/eval-catch-5.m | |
33 %!test | |
34 %! eval ("clear a; a; str = '';", "str=lasterr;"); | |
35 %! assert (lasterr()(1:13), "'a' undefined"); | |
36 %! assert (str(1:13), "'a' undefined"); | |
37 | |
38 %% test/octave.test/eval-catch/eval-catch-6.m | |
39 %!test | |
40 %! eval ("error ('user-defined error'); str = '';", "str = lasterr;"); | |
41 %! assert (lasterr()(1:18), "user-defined error"); | |
42 %! assert (str(1:18), "user-defined error"); | |
43 | |
44 %% test/octave.test/eval-catch/eval-catch-7.m | |
45 %!function ms = mangle (s) | |
46 %! ## Wrap angle brackets around S. | |
47 %! ms = cstrcat ("<", s, ">"); | |
48 %!endfunction | |
49 %!test | |
50 %! eval ("clear a; a; str='';", "str = mangle (lasterr);"); | |
51 %! assert (mangle(lasterr)(1:14), "<'a' undefined"); | |
52 %! assert (str(1:14), "<'a' undefined"); | |
53 | |
54 %% test/octave.test/eval-catch/eval-catch-8.m | |
55 %!test | |
56 %! eval ("eval (\"clear a; a;str1='';\", \"str1=lasterr;\"); clear b; b; str2='';", | |
57 %! "str2 = lasterr;"); | |
58 %! assert (str1(1:13), "'a' undefined"); | |
59 %! assert (str2(1:13), "'b' undefined"); | |
60 | |
61 %% test/octave.test/eval-catch/eval-catch-9.m | |
62 %!test | |
63 %! eval ("clear a; a; str1='';", | |
64 %! "eval (\"clear b; b; str2='';\", \"str2=lasterr;\"); str1=lasterr;"); | |
65 %! assert (str1(1:13), "'b' undefined"); | |
66 %! assert (str2(1:13), "'b' undefined"); | |
67 | |
68 %% test/octave.test/eval-catch/eval-catch-10.m | |
69 %!test | |
70 %! eval ("eval (\"clear a; a; str='';\",\"error (cstrcat (\\\"rethrow: \\\", lasterr));str='';\");", | |
71 %! "str=lasterr;"); | |
72 %! assert (str(1:22), "rethrow: 'a' undefined"); | |
73 |