Mercurial > octave
annotate test/bug-53599.tst @ 30920:47cbc69e66cd
eliminate direct access to call stack from evaluator
The call stack is an internal implementation detail of the evaluator.
Direct access to it outside of the evlauator should not be needed.
* pt-eval.h (tree_evaluator::get_call_stack): Delete.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 08 Apr 2022 15:19:22 -0400 |
parents | 9080316864bf |
children | 332a6ccac881 |
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) |
c80323fe4938
improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 %! global gval |
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> |
25201
c80323fe4938
improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 %! global gval |
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 |
c80323fe4938
improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 %! global gval |
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 |