Mercurial > octave
annotate test/bug-53579.tst @ 31564:332a6ccac881 stable
maint: cleanup code in BIST tests to use Octave coding conventions.
* data.cc: Use keyword "endfor" rather than bare "end".
* file-io.cc, graphics.cc:
Remove semicolon ';' at end of "end_try_catch" keyword.
* variables.cc, bug-35448.tst, bug-53027.tst, bug-53579.tst, bug-53599.tst,
bug-53956.tst, bug-55758.tst, global.tst:
Use semicolon ';' after "global" variable declaration.
* for.tst, io.tst: Delete semicolon ';' at end of "for" loop declaration.
* struct.tst: Delete semicolon ';' at end of "function" declaration.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 27 Nov 2022 17:01:00 -0800 |
parents | 34617dd78f02 |
children | 13362cd35b72 |
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) |
31564
332a6ccac881
maint: cleanup code in BIST tests to use Octave coding conventions.
Rik <rik@octave.org>
parents:
26182
diff
changeset
|
2 %! global aa bb; |
25203
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> |
31564
332a6ccac881
maint: cleanup code in BIST tests to use Octave coding conventions.
Rik <rik@octave.org>
parents:
26182
diff
changeset
|
11 %! global aa bb; |
25203
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 |