Mercurial > octave
annotate test/eval-command.tst @ 30564:796f54d4ddbf stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
In all .txi and .texi files except gpl.txi and gpl.texi in the
doc/liboctave and doc/interpreter directories, change the copyright
to "Octave Project Developers", the same as used for other source
files. Update copyright notices for 2022 (not done since 2019). For
gpl.txi and gpl.texi, change the copyright notice to be "Free Software
Foundation, Inc." and leave the date at 2007 only because this file
only contains the text of the GPL, not anything created by the Octave
Project Developers.
Add Paul Thomas to contributors.in.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Dec 2021 18:22:40 -0500 |
parents | de40b395b9c3 |
children | 597f3ee61a48 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29493
diff
changeset
|
3 ## Copyright (C) 2013-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26662
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
22799
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
7 ## |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
8 ## This file is part of Octave. |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23221
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
22799
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23221
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22799
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
13 ## (at your option) any later version. |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
14 ## |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
18 ## GNU General Public License for more details. |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
19 ## |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23221
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
22799
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
17913
diff
changeset
|
25 |
26662
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
26 %!function r = sigma (opt) |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
27 %! global sigma_call; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
28 %! if (nargin == 0) |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
29 %! sigma_call = "function"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
30 %! r = 1; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
31 %! elseif (ischar (opt)) |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
32 %! sigma_call = "command"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
33 %! r = 1; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
34 %! else |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
35 %! sigma_call = "unexpected"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
36 %! endif |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
37 %!endfunction |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
38 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
39 %!function f1 () |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
40 %! ## ERROR; sigma used as variable and later parsed as command |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
41 %! sigma = svd (1); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
42 %! eval ("sigma -1;"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
43 %!endfunction |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
44 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
45 %!function f1a () |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
46 %! ## Assignment of eval result means eval code is not parsed as command. |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
47 %! sigma = svd (1); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
48 %! val = eval ("sigma -1;"); |
16360
11115c237231
recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 %!endfunction |
26662
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
50 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
51 %!function f2 () |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
52 %! ## ERROR; sigma used as variable and later parsed as command |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
53 %! [u, sigma, v] = svd (1); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
54 %! eval ("sigma -1;"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
55 %!endfunction |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
56 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
57 %!function f2a () |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
58 %! ## Assignment of eval result means eval code is not parsed as command. |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
59 %! [u, sigma, v] = svd (1); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
60 %! val = eval ("sigma -1;"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
61 %!endfunction |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
62 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
63 %!function f3 (sigma) |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
64 %! ## No assignment of eval result means eval code is parsed as command. |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
65 %! ## If f3 is called with a value for sigma, it will be used. Otherwise, |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
66 %! ## search for the function sigma and call with no arguments. |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
67 %! eval ("sigma -1;"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
68 %!endfunction |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
69 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
70 %!function f3a (sigma) |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
71 %! ## Assignment of eval result means eval code is not parsed as command. |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
72 %! val = eval ("sigma -1;"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
73 %!endfunction |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
74 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
75 %!function f4 () |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
76 %! ## No assignment of eval result means eval code is parsed as command. |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
77 %! eval ("sigma -1;"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
78 %!endfunction |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
79 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
80 %!function f4a () |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
81 %! ## Assignment of eval result means eval code is not parsed as command. |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
82 %! val = eval ("sigma -1;"); |
16360
11115c237231
recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
83 %!endfunction |
26662
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
84 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
85 %!test <55610> |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
86 %! global sigma_call; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
87 %! sigma_call = "none"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
88 %! ## Matlab complains about sigma previously being used as a variable |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
89 %! ## before being used as a command. |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
90 %! fail ("f1 ()", "used as variable and later as function"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
91 %! assert (sigma_call, "none"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
92 %! clear -global sigma_call |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
93 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
94 %!test <55610> |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
95 %! global sigma_call; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
96 %! sigma_call = "none"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
97 %! f1a (); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
98 %! assert (sigma_call, "none"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
99 %! clear -global sigma_call |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
100 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
101 %!test <55610> |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
102 %! global sigma_call; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
103 %! sigma_call = "none"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
104 %! ## Matlab complains about sigma previously being used as a variable |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
105 %! ## before being used as a command. |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
106 %! fail ("f2 ()", "used as variable and later as function"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
107 %! assert (sigma_call, "none"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
108 %! clear -global sigma_call |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
109 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
110 %!test <55610> |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
111 %! global sigma_call; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
112 %! sigma_call = "none"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
113 %! f2a (); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
114 %! assert (sigma_call, "none"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
115 %! clear -global sigma_call |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
116 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
117 %!test <55610> |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
118 %! global sigma_call; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
119 %! sigma_call = "none"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
120 %! f3 (); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
121 %! assert (sigma_call, "command"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
122 %! clear -global sigma_call |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
123 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
124 %!test <55610> |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
125 %! global sigma_call; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
126 %! sigma_call = "none"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
127 %! f3a (); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
128 %! assert (sigma_call, "function"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
129 %! clear -global sigma_call |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
130 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
131 %!test <55610> |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
132 %! global sigma_call; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
133 %! sigma_call = "none"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
134 %! ## NOTE: this result disagrees with Matlab, which evaluates sigma |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
135 %! ## as a command-style function even though there is a variable named |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
136 %! ## sigma defined in the workspace prior to evaluating the function |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
137 %! ## call (compare with f1() and f2() above). |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
138 %! fail ("f3 (1)", "used as variable and later as function"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
139 %! assert (sigma_call, "none"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
140 %! clear -global sigma_call |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
141 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
142 %!test <55610> |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
143 %! global sigma_call; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
144 %! sigma_call = "none"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
145 %! f3a (1); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
146 %! assert (sigma_call, "none"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
147 %! clear -global sigma_call |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
148 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
149 %!test <55610> |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
150 %! global sigma_call; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
151 %! sigma_call = "none"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
152 %! f4 (); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
153 %! assert (sigma_call, "command"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
154 %! clear -global sigma_call |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
155 %! |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
156 %!test <55610> |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
157 %! global sigma_call; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
158 %! sigma_call = "none"; |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
159 %! f4a (); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
160 %! assert (sigma_call, "function"); |
05fc703b419a
update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
161 %! clear -global sigma_call |
29349
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
162 |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
163 %!function r = f_eval_fun () |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
164 %! evalin_value = "this is f_eval_fun"; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
165 %! r = evalin ("caller", "evalin_value"); |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
166 %!endfunction |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
167 %!function r = g_eval_fun () |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
168 %! evalin_value = "this is g_eval_fun"; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
169 %! r = evalin ("caller", "f_eval_fun ()"); |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
170 %!endfunction |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
171 %!function r = h_eval_fun () |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
172 %! evalin_value = "this is h_eval_fun"; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
173 %! r = f_eval_fun (); |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
174 %!endfunction |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
175 |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
176 %!shared evalin_value |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
177 %! evalin_value = "this is the caller"; |
29493
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
178 %!assert <*59847> (f_eval_fun (), "this is the caller"); |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
179 %!assert <*59847> (g_eval_fun (), "this is the caller"); |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
180 %!assert <*59847> (h_eval_fun (), "this is h_eval_fun"); |
29349
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
181 |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
182 %!function r = f_asgn_fun () |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
183 %! asgnin_value = "this is f_asgn_fun"; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
184 %! assignin ("caller", "asgnin_value", "f value"); |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
185 %! r = asgnin_value; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
186 %!endfunction |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
187 %!function r = g_asgn_fun () |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
188 %! asgnin_value = "this is g_asgn_fun"; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
189 %! evalin ("caller", "f_asgn_fun ();"); |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
190 %! r = asgnin_value; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
191 %!endfunction |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
192 %!function r = h_asgn_fun () |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
193 %! asgnin_value = "this is h_asgn_fun"; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
194 %! f_asgn_fun (); |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
195 %! r = asgnin_value; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
196 %!endfunction |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
197 |
29493
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
198 %!test <*59847> |
29349
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
199 %! asgnin_value = "this is the caller"; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
200 %! assert (f_asgn_fun (), "this is f_asgn_fun"); |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
201 %! assert (asgnin_value, "f value"); |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
202 |
29493
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
203 %!test <*59847> |
29349
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
204 %! asgnin_value = "this is the caller"; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
205 %! assert (g_asgn_fun (), "this is g_asgn_fun"); |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
206 %! assert (asgnin_value, "f value"); |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
207 |
29493
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
208 %!test <*59847> |
29349
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
209 %! asgnin_value = "this is the caller"; |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
210 %! assert (h_asgn_fun (), "f value"); |
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
211 %! assert (asgnin_value, "this is the caller"); |