Mercurial > octave
annotate test/bug-53579.tst @ 31211:8340137bb190
maint: Merge stable to default.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Mon, 29 Aug 2022 13:58:00 +0200 |
parents | 34617dd78f02 |
children | 332a6ccac881 |
rev | line source |
---|---|
25203
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 %!function [raa, rbb, igaa, igbb] = sub1 (aa, bb) |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 %! global aa bb |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
3 %! aa = 1; |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 %! raa = aa; |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 %! rbb = bb; |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 %! igaa = isglobal ("aa"); |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 %! igbb = isglobal ("bb"); |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 %!endfunction |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 %!test <*53579> |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 %! global aa bb |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 %! assert (isglobal ("aa")); |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 %! assert (isglobal ("bb")); |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 %! aa = 3; |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 %! xx = 5; |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 %! [raa, rbb, igaa, igbb] = sub1 (aa, xx); |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 %! assert (raa, 1); |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 %! assert (rbb, []); |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 %! assert (igaa); |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 %! assert (igbb); |
72ea868ca63a
allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 %! assert (xx, 5); |
26182
34617dd78f02
avoid possible leaked global variables in tests
John W. Eaton <jwe@octave.org>
parents:
25203
diff
changeset
|
22 %! clear -global aa bb; # cleanup after test |