Mercurial > octave
annotate test/bug-40117.tst @ 31221:f5755dbacd8d
maint: merge stable to default
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Wed, 31 Aug 2022 22:04:02 +0200 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
rev | line source |
---|---|
28710
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 ######################################################################## |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
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) 2020-2022 The Octave Project Developers |
28710
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 ## |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 ## |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 ## This file is part of Octave. |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 ## |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 ## under the terms of the GNU General Public License as published by |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 ## (at your option) any later version. |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 ## |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 ## GNU General Public License for more details. |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 ## |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 ## along with Octave; see the file COPYING. If not, see |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 ## |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 ######################################################################## |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 %!function __mktestfun_40117__ (file, varargin) |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 %! unwind_protect |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 %! fid = fopen (file, "w"); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 %! fprintf (fid, "%s\n", varargin{:}); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 %! unwind_protect_cleanup |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 %! if (fid > 0) |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 %! fclose (fid); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 %! endif |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 %! end_unwind_protect |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 %!endfunction |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 |
29493
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
37 %!test <*40117> |
28710
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 %! unwind_protect |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 %! tmp_dir = tempname (); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 %! mkdir (tmp_dir); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 %! a_dir = fullfile (tmp_dir, "a"); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 %! a_private_dir = fullfile (a_dir, "private"); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 %! mkdir (a_dir); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 %! mkdir (a_private_dir); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 %! __mktestfun_40117__ (fullfile (a_dir, "main_40117.m"), |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 %! "function r = main_40117 ()", |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 %! " r = p1_40117 ();", |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 %! "endfunction"); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 %! __mktestfun_40117__ (fullfile (a_private_dir, "p1_40117.m"), |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 %! "function r = p1_40117 ()", |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 %! " r = p2_40117 ();", |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 %! "endfunction"); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 %! __mktestfun_40117__ (fullfile (a_private_dir, "p2_40117.m"), |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 %! "function r = p2_40117 ()", |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 %! " r = 'a_p2_40117';", |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 %! "endfunction"); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 %! addpath (a_dir); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 %! assert (main_40117 (), "a_p2_40117"); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 %! |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
60 %! ## Update the secondary private function, attempting to avoid |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 %! ## filesystem timestamp resolution problems. |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 %! pause (1); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 %! __mktestfun_40117__ (fullfile (a_private_dir, "p2_40117.m"), |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 %! "function r = p2_40117 ()", |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 %! " r = 'new function!';", |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
66 %! "endfunction"); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
67 %! |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
68 %! ## Force new functions to be found. |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
69 %! rehash (); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
70 %! |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 %! assert (main_40117 (), "new function!"); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 %! unwind_protect_cleanup |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
73 %! rmpath (a_dir); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
74 %! confirm_recursive_rmdir (false, "local"); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
75 %! rmdir (tmp_dir, "s"); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
76 %! end_unwind_protect |