Mercurial > octave-nkf
annotate test/test_unwind.m @ 14193:72aebe619641 stable rc-3-6-0-0
3.6.0-rc0 release candidate
* configure.ac (AC_INIT): Version is now 3.6.0-rc0.
(OCTAVE_RELEASE_DATE): Now 2012-01-10.
(OCTAVE_API_VERSION_NUMBER): Now 47.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 10 Jan 2012 16:43:41 -0500 |
parents | 72c96de7a403 |
children |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14131
diff
changeset
|
1 ## Copyright (C) 2006-2012 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 %% test/octave.test/unwind/unwind-1.m |
20 %!function y = f (x) | |
21 %! global g; | |
22 %! save_g = g; | |
23 %! unwind_protect | |
24 %! g = 0; | |
25 %! y = g; | |
26 %! [1,2;x]; | |
27 %! g = 1; | |
28 %! y = [y, g]; | |
29 %! unwind_protect_cleanup | |
30 %! g = save_g; | |
31 %! y = [y, g]; | |
32 %! 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
|
33 %!endfunction |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
34 %! |
5590 | 35 %!test |
36 %! global g = -1; | |
37 %! 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
|
38 %! assert (y, [0,1,-1]); |
5590 | 39 |
40 %% test/octave.test/unwind/unwind-2.m | |
41 %!function y = f (x) | |
42 %! global g; | |
43 %! save_g = g; | |
44 %! unwind_protect | |
45 %! g = 0; | |
46 %! y = g; | |
47 %! [1,2;x]; | |
48 %! g = 1; | |
49 %! y = [y, g]; | |
50 %! unwind_protect_cleanup | |
51 %! g = save_g; | |
52 %! 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
|
53 %! assert (y, [0,-1]); |
5590 | 54 %! 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
|
55 %!endfunction |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
56 %! |
5590 | 57 %!test |
58 %! 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
|
59 %! fail ("y = f (3);", "mismatch"); |
5590 | 60 |