annotate test/bug-53599.tst @ 33608:5fba13104493 bytecode-interpreter tip

maint: merge default to bytecode-interpreter.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Sat, 18 May 2024 22:40:00 -0400
parents 332a6ccac881
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 %!function rval = sggval (val)
31564
332a6ccac881 maint: cleanup code in BIST tests to use Octave coding conventions.
Rik <rik@octave.org>
parents: 30110
diff changeset
2 %! global gval;
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 %! if (nargin == 1)
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 %! gval = val;
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 %! else
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 %! rval = gval;
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 %! endif
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 %!endfunction
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9
30110
9080316864bf update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 30109
diff changeset
10 %!test <*53599>
31564
332a6ccac881 maint: cleanup code in BIST tests to use Octave coding conventions.
Rik <rik@octave.org>
parents: 30110
diff changeset
11 %! global gval;
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 %! assert (isempty (gval))
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 %! sggval (13);
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 %! assert (sggval (), 13);
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 %! assert (gval, 13);
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 %! clear global gval
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 %! assert (sggval (), [])
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 %! gval = 42;
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 %! assert (sggval (), []);
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 %! clear gval
31564
332a6ccac881 maint: cleanup code in BIST tests to use Octave coding conventions.
Rik <rik@octave.org>
parents: 30110
diff changeset
21 %! global gval;
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22 %! gval = 42;
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 %! assert (sggval (), 42);
26182
34617dd78f02 avoid possible leaked global variables in tests
John W. Eaton <jwe@octave.org>
parents: 25201
diff changeset
24 %! clear -global gval; # cleanup after test