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/global/global-1.m |
|
20 %!test |
|
21 %! global G = 1; |
|
22 %! assert(G,1) |
|
23 |
|
24 %% test/octave.test/global/global-2.m |
|
25 %!function f () |
|
26 %! global G; |
|
27 %! assert(G,1); |
|
28 %!test |
|
29 %! global G = 1; |
|
30 %! f; |
|
31 |
|
32 %% test/octave.test/global/global-3.m |
|
33 %!function f () |
|
34 %! fail("G"); |
|
35 %!test |
|
36 %! global G = 1; |
|
37 %! f(); |
|
38 |
|
39 %% test/octave.test/global/global-4.m |
|
40 %!function f () |
|
41 %! global H = 1; |
|
42 %!test |
|
43 %! f; |
|
44 %! fail("H"); |
|
45 |
|
46 %% test/octave.test/global/global-5.m |
|
47 %!function f () |
|
48 %! global H = 1; |
|
49 %!test |
|
50 %!function g () |
|
51 %! fail("H"); |
|
52 %!test |
|
53 %! g(); |
|
54 |
|
55 %% test/octave.test/global/global-6.m |
|
56 %!function f () |
|
57 %! global H = 1; |
|
58 %!function g () |
|
59 %! global H; |
|
60 %! assert(H,1); |
|
61 %!test |
|
62 %! f(); |
|
63 %! g(); |
|
64 |
|
65 %% test/octave.test/global/global-7.m |
|
66 %!test |
|
67 %!function f () |
|
68 %! global H = 1; |
|
69 %!test |
|
70 %! fail("H"); |
|
71 |
|
72 %% test/octave.test/global/global-8.m |
|
73 %!function f () |
|
74 %! global H = 1; |
|
75 %!function g () |
|
76 %! global H; |
|
77 %! assert(H,1) |
|
78 %!test |
|
79 %! f; |
|
80 %! clear H |
|
81 %! g; |
|
82 |