Mercurial > hg > octave-lyh
annotate test/test_unwind.m @ 11586:12df7854fa7c
strip trailing whitespace from source files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:24:59 -0500 |
parents | fd0a3ac60b0e |
children | c3309e1ec50d |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2006-2011 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 | |
33 %!test | |
34 %! global g = -1; | |
35 %! y = f ([3,4]); | |
36 %! assert(y,[0,1,-1]); | |
37 | |
38 %% test/octave.test/unwind/unwind-2.m | |
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]; | |
51 %! assert(y,[0,-1]); | |
52 %! end_unwind_protect | |
53 %!test | |
54 %! global g = -1; | |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
9245
diff
changeset
|
55 %! fail("y = f (3);","mismatch"); |
5590 | 56 |