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/unwind/unwind-1.m |
|
22 %!function y = f (x) |
|
23 %! global g; |
|
24 %! save_g = g; |
|
25 %! unwind_protect |
|
26 %! g = 0; |
|
27 %! y = g; |
|
28 %! [1,2;x]; |
|
29 %! g = 1; |
|
30 %! y = [y, g]; |
|
31 %! unwind_protect_cleanup |
|
32 %! g = save_g; |
|
33 %! y = [y, g]; |
|
34 %! end_unwind_protect |
|
35 %!test |
|
36 %! global g = -1; |
|
37 %! y = f ([3,4]); |
|
38 %! assert(y,[0,1,-1]); |
|
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]; |
|
53 %! assert(y,[0,-1]); |
|
54 %! end_unwind_protect |
|
55 %!test |
|
56 %! global g = -1; |
|
57 %! fail("y = f (3);","number of columns must match"); |
|
58 |