Mercurial > octave-nkf
annotate test/unwind.tst @ 20614:10ec79b47808
use new string_value method to handle value extraction errors
* __voronoi__.cc, chol.cc, colamd.cc, fftw.cc:
Use new string_value method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 08 Oct 2015 18:15:56 -0400 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
19731
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
1 ## Copyright (C) 2006-2015 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 %!function y = f (x) |
20 %! global g; | |
21 %! save_g = g; | |
22 %! unwind_protect | |
23 %! g = 0; | |
24 %! y = g; | |
25 %! [1,2;x]; | |
26 %! g = 1; | |
27 %! y = [y, g]; | |
28 %! unwind_protect_cleanup | |
29 %! g = save_g; | |
30 %! y = [y, g]; | |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
31 %! end # "end" is part of test, check not using "end_unwind_protect" |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
32 %!endfunction |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
33 %! |
5590 | 34 %!test |
35 %! global g = -1; | |
36 %! y = f ([3,4]); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
37 %! assert (y, [0,1,-1]); |
5590 | 38 |
39 %!function y = f (x) | |
40 %! global g; | |
41 %! save_g = g; | |
42 %! unwind_protect | |
43 %! g = 0; | |
44 %! y = g; | |
45 %! [1,2;x]; | |
46 %! g = 1; | |
47 %! y = [y, g]; | |
48 %! unwind_protect_cleanup | |
49 %! g = save_g; | |
50 %! y = [y, g]; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
51 %! assert (y, [0,-1]); |
5590 | 52 %! end_unwind_protect |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
53 %!endfunction |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
54 %! |
5590 | 55 %!test |
56 %! global g = -1; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
57 %! fail ("y = f (3);", "mismatch"); |
5590 | 58 |