annotate test/system.tst @ 30211:54520422f056

simplify mkdir and allow it to create parent directory (bug #61166) * mkdir.m: Always perform tilde expansion on parent. If both parent and dirname are supplied, use fullfile to concatentate with dirname. Recursively create all directories. * system.tst: New test.
author John W. Eaton <jwe@octave.org>
date Fri, 24 Sep 2021 10:46:49 -0400
parents 7854d5752dd2
children 8398d31dab76
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 ##
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
3 ## Copyright (C) 2006-2021 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27190
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/>.
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
7 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
8 ## This file is part of Octave.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23417
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
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: 23417
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22545
diff changeset
13 ## (at your option) any later version.
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
14 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22545
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22545
diff changeset
18 ## GNU General Public License for more details.
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
19 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
20 ## You should have received a copy of the GNU General Public License
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
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: 23417
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 ########################################################################
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
25
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
26 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
27 %! [t1, u1, s1] = cputime ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
28 %! for i = 1:200
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
29 %! sin (i);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
30 %! endfor
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
31 %! [t2, u2, s2] = cputime ();
22545
29dab5b8332a system.tst: Add tolerance of 2*eps to cputime() tests (bug #49166).
Rik <rik@octave.org>
parents: 22323
diff changeset
32 %! assert (t1, u1 + s1, 2*eps (t1));
29dab5b8332a system.tst: Add tolerance of 2*eps to cputime() tests (bug #49166).
Rik <rik@octave.org>
parents: 22323
diff changeset
33 %! assert (t2, u2 + s2, 2*eps (t2));
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
34 %! assert (t2 >= t1);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
35 %! assert (u2 >= u2);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
36 %! assert (s2 >= s2);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
37
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
38 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
39 %! tic ();
21569
6a550a383bf1 system.tst: Remove tests of deprecated functions sleep, usleep.
Rik <rik@octave.org>
parents: 21456
diff changeset
40 %! pause (2);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
41 %! assert (toc () > 0);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
42
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
43 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
44 %! pause (0);
16019
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14742
diff changeset
45 %! __printf_assert__ ("ok\n");
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14742
diff changeset
46 %! assert (__prog_output_assert__ ("ok"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
47
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
48 %!error <Invalid call to pause> pause (1, 2)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
49
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
50 %!test
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19168
diff changeset
51 %! from = tempname ();
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19168
diff changeset
52 %! to = tempname ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
53 %! id = fopen (from, "wb");
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
54 %! if (id > 0 && fclose (id) == 0)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
55 %! [s, e] = stat (from);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
56 %! if (! e)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
57 %! if (rename (from, to) == 0)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
58 %! [s, e] = stat (from);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
59 %! if (e < 0)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
60 %! [s, e] = stat (to);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
61 %! assert (e == 0);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
62 %! unlink (to);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
63 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
64 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
65 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
66 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
67
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
68 %!error <Invalid call to rename> rename ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
69 %!error <Invalid call to rename> rename ("foo", "bar", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
70
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
71 %!test
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19168
diff changeset
72 %! nm = tempname ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
73 %! if ((id = fopen (nm, "wb")) > 0)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
74 %! [s, err] = stat (nm);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
75 %! if (! err && fclose (id) == 0 && unlink (nm) == 0)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
76 %! [s, err] = stat (nm);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
77 %! assert (err < 0);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
78 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
79 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
80
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
81 %!error <Invalid call to unlink> unlink ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
82 %!error <Invalid call to unlink> unlink ("foo", 1)
19135
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
83 %!error <FILE must be a string> unlink ({})
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
84
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
85 %!test
5595
83df01a26136 [project @ 2006-01-13 20:01:08 by jwe]
jwe
parents: 5590
diff changeset
86 %! [files, status, msg] = readdir (filesep);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
87 %! assert (iscell (files) && status == 0 && strcmp (msg, ""));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
88
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
89 %!error <Invalid call to readdir> readdir ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
90 %!error <Invalid call to readdir> readdir ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
91
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
92 %!test
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19168
diff changeset
93 %! nm = tempname ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
94 %! e1 = mkdir (nm);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
95 %! [s2, e2] = stat (nm);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
96 %! e3 = rmdir (nm);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
97 %! [s4, e4] = stat (nm);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
98 %! assert ((e1 && strcmp (s2.modestr(1), "d") && e3 && e4 < 0));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
99
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
100 %!error <Invalid call to mkdir> mkdir ()
28564
1dd765e54265 fix tests for new argument number mismatch error message
John W. Eaton <jwe@octave.org>
parents: 28087
diff changeset
101 %!error <called with too many inputs> mkdir ("foo", 1, 2)
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
102 %!error <Invalid call to rmdir> rmdir ()
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
103
30211
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
104 %!test <61166>
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
105 %! crr = confirm_recursive_rmdir ();
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
106 %! unwind_protect
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
107 %! confirm_recursive_rmdir (0);
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
108 %! tmp_dir = tempname ();
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
109 %! e1 = mkdir (tmp_dir);
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
110 %! ## parent dir that exists
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
111 %! mkdir (tmp_dir, "d1");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
112 %! mkdir (tmp_dir, "d2/foo");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
113 %! mkdir (tmp_dir, "d3/foo.bar");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
114 %! assert (isfolder (fullfile (tmp_dir, "d1")));
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
115 %! assert (isfolder (fullfile (tmp_dir, "d2/foo")));
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
116 %! assert (isfolder (fullfile (tmp_dir, "d3/foo.bar")));
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
117 %! ## parent dir that does not exist
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
118 %! d4 = fullfile (tmp_dir, "d4");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
119 %! d5 = fullfile (tmp_dir, "d5");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
120 %! d6 = fullfile (tmp_dir, "d6");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
121 %! mkdir (d4, "foo");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
122 %! mkdir (d5, "foo/bar");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
123 %! mkdir (d6, "foo/bar.baz");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
124 %! assert (isfolder (fullfile (d4, "foo")));
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
125 %! assert (isfolder (fullfile (d5, "foo/bar")));
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
126 %! assert (isfolder (fullfile (d6, "foo/bar.baz")));
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
127 %! d7 = fullfile (tmp_dir, "d7/foo");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
128 %! d8 = fullfile (tmp_dir, "d8/foo/bar");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
129 %! d9 = fullfile (tmp_dir, "d9/foo/bar.baz");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
130 %! mkdir (d7);
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
131 %! mkdir (d8);
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
132 %! mkdir (d9);
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
133 %! assert (isfolder (d7));
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
134 %! assert (isfolder (d8));
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
135 %! assert (isfolder (d9));
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
136 %! unwind_protect_cleanup
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
137 %! rmdir (tmp_dir, "s");
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
138 %! confirm_recursive_rmdir (crr);
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
139 %! end_unwind_protect
54520422f056 simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
140
5648
69a4f320d95a [project @ 2006-03-08 20:17:37 by dbateman]
dbateman
parents: 5595
diff changeset
141 %!test
6327
4905c543b301 [project @ 2007-02-19 19:59:26 by jwe]
jwe
parents: 6200
diff changeset
142 %! crr = confirm_recursive_rmdir ();
4905c543b301 [project @ 2007-02-19 19:59:26 by jwe]
jwe
parents: 6200
diff changeset
143 %! confirm_recursive_rmdir (0);
28087
9cb04a9e81ec rmdir: throw an error if operation fails and nargout == 0 (bug #57830).
Rik <rik@octave.org>
parents: 27923
diff changeset
144 %! assert (! rmdir ("foo", "s"));
6327
4905c543b301 [project @ 2007-02-19 19:59:26 by jwe]
jwe
parents: 6200
diff changeset
145 %! confirm_recursive_rmdir (crr);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
146
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
147 %!test
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
148 %! ## Test makes no sense on Windows systems
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
149 %! if (isunix () || ismac ())
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
150 %! orig_umask = umask (0);
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19168
diff changeset
151 %! nm = tempname ();
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
152 %! id = fopen (nm, "wb");
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
153 %! s1 = stat (nm);
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
154 %! fclose (id);
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
155 %! unlink (nm);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
156 %!
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
157 %! umask (777);
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19168
diff changeset
158 %! nm = tempname ();
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
159 %! id = fopen (nm, "wb");
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
160 %! s2 = stat (nm);
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
161 %! fclose (id);
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
162 %! unlink (nm);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
163 %!
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
164 %! assert (deblank (s1.modestr), "-rw-rw-rw-");
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
165 %! assert (deblank (s2.modestr), "----------");
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
166 %! ## Restore original umask value
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
167 %! umask (orig_umask);
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
168 %! endif
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
169
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
170 %!error <Invalid call to umask> umask ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
171 %!error <Invalid call to umask> umask (1, 2)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
172
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
173 %!test
5595
83df01a26136 [project @ 2006-01-13 20:01:08 by jwe]
jwe
parents: 5590
diff changeset
174 %! [s, err, msg] = stat (filesep);
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
175 %! assert (err == 0
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
176 %! && isstruct (s)
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
177 %! && isfield (s, "dev")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
178 %! && isfield (s, "ino")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
179 %! && isfield (s, "modestr")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
180 %! && isfield (s, "nlink")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
181 %! && isfield (s, "uid")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
182 %! && isfield (s, "gid")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
183 %! && isfield (s, "size")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
184 %! && isfield (s, "atime")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
185 %! && isfield (s, "mtime")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
186 %! && isfield (s, "ctime")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
187 %! && ischar (msg));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
188
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
189 %!error <Invalid call to stat> stat ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
190 %!error <Invalid call to stat> stat ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
191
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
192 %!test
5595
83df01a26136 [project @ 2006-01-13 20:01:08 by jwe]
jwe
parents: 5590
diff changeset
193 %! [s, err, msg] = lstat (filesep);
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
194 %! assert (err == 0
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
195 %! && isstruct (s)
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
196 %! && isfield (s, "dev")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
197 %! && isfield (s, "ino")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
198 %! && isfield (s, "modestr")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
199 %! && isfield (s, "nlink")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
200 %! && isfield (s, "uid")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
201 %! && isfield (s, "gid")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
202 %! && isfield (s, "size")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
203 %! && isfield (s, "atime")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
204 %! && isfield (s, "mtime")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
205 %! && isfield (s, "ctime")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
206 %! && ischar (msg));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
207
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
208 %!error <Invalid call to lstat> lstat ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
209 %!error <Invalid call to lstat> lstat ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
210
19135
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
211 %!test
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
212 %! if (isunix ())
19165
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19135
diff changeset
213 %! assert (S_ISCHR (stat ("/dev/null").mode));
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19135
diff changeset
214 %! if (exist ("/dev/initctl"))
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19135
diff changeset
215 %! assert (S_ISFIFO (stat ("/dev/initctl").mode));
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19135
diff changeset
216 %! endif
21456
c1c7748b00fe system.tst: Fix failing BIST test if /dev/core does not exist on UNIX system
Mike Miller <mtmiller@octave.org>
parents: 21434
diff changeset
217 %! if (exist ("/dev/core"))
c1c7748b00fe system.tst: Fix failing BIST test if /dev/core does not exist on UNIX system
Mike Miller <mtmiller@octave.org>
parents: 21434
diff changeset
218 %! assert (S_ISLNK (lstat ("/dev/core").mode));
c1c7748b00fe system.tst: Fix failing BIST test if /dev/core does not exist on UNIX system
Mike Miller <mtmiller@octave.org>
parents: 21434
diff changeset
219 %! endif
19135
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
220 %! endif
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19168
diff changeset
221 %! nm = tempname ();
19135
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
222 %! fid = fopen (nm, "wb");
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
223 %! fclose (fid);
19165
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19135
diff changeset
224 %! r = [ S_ISREG(stat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19135
diff changeset
225 %! S_ISDIR(stat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19135
diff changeset
226 %! S_ISCHR(stat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19135
diff changeset
227 %! S_ISBLK(stat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19135
diff changeset
228 %! S_ISFIFO(stat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19135
diff changeset
229 %! S_ISLNK(lstat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19135
diff changeset
230 %! S_ISSOCK(stat(nm).mode) ];
19135
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
231 %! unlink (nm);
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
232 %! assert (r(:), [true; false; false; false; false; false; false]);
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
233
20704
571508c1ed06 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20017
diff changeset
234 %!error <S_ISREG: invalid MODE value> S_ISREG ({})
571508c1ed06 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20017
diff changeset
235 %!error <S_ISDIR: invalid MODE value> S_ISDIR ({})
571508c1ed06 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20017
diff changeset
236 %!error <S_ISCHR: invalid MODE value> S_ISCHR ({})
571508c1ed06 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20017
diff changeset
237 %!error <S_ISBLK: invalid MODE value> S_ISBLK ({})
571508c1ed06 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20017
diff changeset
238 %!error <S_ISFIFO: invalid MODE value> S_ISFIFO ({})
571508c1ed06 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20017
diff changeset
239 %!error <S_ISLNK: invalid MODE value> S_ISLNK ({})
571508c1ed06 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20017
diff changeset
240 %!error <S_ISSOCK: invalid MODE value> S_ISSOCK ({})
19135
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
241
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
242 %!error <Invalid call to S_ISREG> S_ISREG ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
243 %!error <Invalid call to S_ISDIR> S_ISDIR ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
244 %!error <Invalid call to S_ISCHR> S_ISCHR ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
245 %!error <Invalid call to S_ISBLK> S_ISBLK ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
246 %!error <Invalid call to S_ISFIFO> S_ISFIFO ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
247 %!error <Invalid call to S_ISLNK> S_ISLNK ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
248 %!error <Invalid call to S_ISSOCK> S_ISSOCK ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19119
diff changeset
249
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
250 %!assert (iscell (glob ([filesep "*"])))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
251
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
252 %!error <Invalid call to glob> glob ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
253 %!error <Invalid call to glob> glob ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
254
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
255 %!assert (ischar (file_in_path (path (), "date.m")))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
256
20711
7b608fadc663 Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents: 20709
diff changeset
257 %!error <file_in_path: optional third argument must be a string> file_in_path ("foo", "bar", 1)
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
258 %!error <Invalid call to file_in_path> file_in_path ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
259 %!error <Invalid call to file_in_path> file_in_path ("foo", "bar", "baz", "ooka")
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
260
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
261 %!testif HAVE_GETPWUID
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
262 %! x = getpwuid (getuid ());
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
263 %! assert (x.dir, tilde_expand (sprintf ("~%s", x.name)));
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
264 %! assert ("foobar", tilde_expand ("foobar"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
265
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
266 %!error <Invalid call to tilde_expand> tilde_expand ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
267 %!error <Invalid call to tilde_expand> tilde_expand ("str", 2)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
268
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
269 %!testif HAVE_GETPGRP
24984
8b50eab9689e system.tst: fix system call test that fails in corner cases
Mike Miller <mtmiller@octave.org>
parents: 24534
diff changeset
270 %! assert (getpgrp () >= 0);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
271
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
272 %!error <... getpgrp> getpgrp (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
273
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
274 %!assert (getpid () > 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
275
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
276 %!error <... getpid> getpid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
277
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
278 %!testif HAVE_GETPPID
23417
80c1fc2b4112 system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents: 23375
diff changeset
279 %! assert (getppid () >= 0);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
280
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
281 %!error <... getppid> getppid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
282
21985
e2e0e353c3ef Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents: 21580
diff changeset
283 %!testif HAVE_GETEUID
e2e0e353c3ef Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents: 21580
diff changeset
284 %! assert (geteuid () >= 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
285
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
286 %!error <... geteuid> geteuid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
287
21985
e2e0e353c3ef Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents: 21580
diff changeset
288 %!testif HAVE_GETUID
e2e0e353c3ef Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents: 21580
diff changeset
289 %! assert (getuid () >= 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
290
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
291 %!error <... getuid> getuid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
292
21985
e2e0e353c3ef Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents: 21580
diff changeset
293 %!testif HAVE_GETEGID
e2e0e353c3ef Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents: 21580
diff changeset
294 %! assert (getegid () >= 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
295
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
296 %!error <... getegid> getegid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
297
21985
e2e0e353c3ef Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents: 21580
diff changeset
298 %!testif HAVE_GETGID
e2e0e353c3ef Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents: 21580
diff changeset
299 %! assert (getgid () >= 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
300
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
301 %!error <... getgid> getgid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
302
20017
4b7b7ac7af2c use get_home_directory instead of getenv ("HOME") (bug #44694)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
303 %!assert (get_home_directory (), tilde_expand ("~"))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
304
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
305 %!error <Invalid call to getenv> getenv ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
306 %!error <Invalid call to getenv> getenv ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
307
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
308 %!test
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
309 %! wns = warning ("query", "Octave:num-to-str");
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
310 %! warning ("on", "Octave:num-to-str");
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
311 %! fail ("getenv (1)", "warning");
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
312 %! warning (wns.state, "Octave:num-to-str");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
313
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
314 %!test
19168
9163a6e9b096 Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents: 19165
diff changeset
315 %! setenv ("foobar", "baz");
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
316 %! assert (getenv ("foobar"), "baz");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
317
19168
9163a6e9b096 Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents: 19165
diff changeset
318 %!error <Invalid call to setenv> setenv ()
9163a6e9b096 Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents: 19165
diff changeset
319 %!error <Invalid call to setenv> setenv ("foo", "bar", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
320
19403
03067dab10ca Use stricter input validation when looking for a string as input (bug #42651).
Rik <rik@octave.org>
parents: 19278
diff changeset
321 %!error <VAR must be a string> setenv (1, 2)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
322
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
323 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
324 %! xdir = pwd ();
27190
8ebe70b98e97 cd: only change to home directory if nargin and nargout are zero (bug #41275)
Michael C. Grant <mcg@cvxr.com>
parents: 26376
diff changeset
325 %! ydir = cd ();
8ebe70b98e97 cd: only change to home directory if nargin and nargout are zero (bug #41275)
Michael C. Grant <mcg@cvxr.com>
parents: 26376
diff changeset
326 %! assert (xdir, ydir);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
327 %! cd /
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
328 %! d1 = pwd ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
329 %! cd (xdir);
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
330 %! if (ispc () && ! isunix ())
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 16937
diff changeset
331 %! ## should be a drive letter
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
332 %! assert (length (d1), 3);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
333 %! assert (d1(2), ":");
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
334 %! assert (d1(3), "\\");
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
335 %! else
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
336 %! assert ("/", d1);
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
337 %! endif
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
338 %! assert (pwd (), xdir);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
339
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
340 %!error cd (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
341
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
342 %!assert (ischar (pwd ()))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
343
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
344 %!testif HAVE_GETPWENT
23417
80c1fc2b4112 system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents: 23375
diff changeset
345 %! endpwent ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
346 %! s = getpwent ();
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
347 %! endpwent ();
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
348 %! assert (isstruct (s)
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
349 %! && isfield (s, "name")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
350 %! && isfield (s, "passwd")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
351 %! && isfield (s, "uid")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
352 %! && isfield (s, "gid")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
353 %! && isfield (s, "gecos")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
354 %! && isfield (s, "dir")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
355 %! && isfield (s, "shell"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
356
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
357 %!error <Invalid call to getpwent> getpwent (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
358
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
359 %!testif HAVE_GETPWUID
23417
80c1fc2b4112 system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents: 23375
diff changeset
360 %! endpwent ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
361 %! x = getpwent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
362 %! y = getpwuid (x.uid);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
363 %! endpwent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
364 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
365
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
366 %!error <Invalid call to getpwuid> getpwuid ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
367 %!error <Invalid call to getpwuid> getpwuid (1, 2)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
368
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
369 %!testif HAVE_GETPWNAM
23417
80c1fc2b4112 system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents: 23375
diff changeset
370 %! endpwent ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
371 %! x = getpwent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
372 %! y = getpwnam (x.name);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
373 %! endpwent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
374 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
375
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
376 %!error <Invalid call to getpwnam> getpwnam ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
377 %!error <Invalid call to getpwnam> getpwnam ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
378
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
379 %!testif HAVE_SETPWENT
23417
80c1fc2b4112 system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents: 23375
diff changeset
380 %! endpwent ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
381 %! x = getpwent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
382 %! setpwent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
383 %! y = getpwent ();
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
384 %! endpwent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
385 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
386
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
387 %!error <Invalid call to setpwent> setpwent (1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
388 %!error <Invalid call to endpwent> endpwent (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
389
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
390 %!testif HAVE_GETGRENT
23417
80c1fc2b4112 system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents: 23375
diff changeset
391 %! endgrent ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
392 %! x = getgrent ();
5678
52323f13c86b [project @ 2006-03-16 06:45:08 by jwe]
jwe
parents: 5648
diff changeset
393 %! endgrent ();
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
394 %! assert (isstruct (x)
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
395 %! && isfield (x, "name")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
396 %! && isfield (x, "passwd")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
397 %! && isfield (x, "gid")
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21569
diff changeset
398 %! && isfield (x, "mem"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
399
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
400 %!error <Invalid call to getgrent> getgrent (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
401
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
402 %!testif HAVE_GETGRGID
23417
80c1fc2b4112 system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents: 23375
diff changeset
403 %! endgrent ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
404 %! x = getgrent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
405 %! y = getgrgid (x.gid);
5678
52323f13c86b [project @ 2006-03-16 06:45:08 by jwe]
jwe
parents: 5648
diff changeset
406 %! endgrent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
407 %! assert (strcmp (x.name, y.name) && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
408
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
409 %!error <Invalid call to getgrgid> getgrgid ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
410 %!error <Invalid call to getgrgid> getgrgid (1, 2)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
411
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
412 %!testif HAVE_GETGRNAM
23417
80c1fc2b4112 system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents: 23375
diff changeset
413 %! endgrent ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
414 %! x = getgrent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
415 %! y = getgrnam (x.name);
5678
52323f13c86b [project @ 2006-03-16 06:45:08 by jwe]
jwe
parents: 5648
diff changeset
416 %! endgrent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
417 %! assert (strcmp (x.name, y.name) && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
418
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
419 %!error <Invalid call to getgrnam> getgrnam ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
420 %!error <Invalid call to getgrnam> getgrnam ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
421
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
422 %!testif HAVE_SETGRENT
23417
80c1fc2b4112 system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents: 23375
diff changeset
423 %! endgrent ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
424 %! x = getgrent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
425 %! setgrent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
426 %! y = getgrent ();
5678
52323f13c86b [project @ 2006-03-16 06:45:08 by jwe]
jwe
parents: 5648
diff changeset
427 %! endgrent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
428 %! assert (strcmp (x.name, y.name) && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
429
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
430 %!error <Invalid call to setgrent> setgrent (1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
431 %!error <Invalid call to endgrent> endgrent (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
432
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
433 %!assert (isieee () == 1 || isieee () == 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
434
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
435 %!assert (isstruct (__octave_config_info__ ()))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
436
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
437 %!assert (isstruct (getrusage ()))