Mercurial > hg > octave-nkf
changeset 17910:c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
* test/system.tst: Don't test umask on Windows systems.
Also, clean up code spacing.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 12 Nov 2013 17:33:30 -0800 |
parents | 88c37cf66fb5 |
children | c98ffba88c78 |
files | test/system.tst |
diffstat | 1 files changed, 22 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/test/system.tst +++ b/test/system.tst @@ -47,7 +47,6 @@ %! assert (__prog_output_assert__ ("ok")); %!error <Invalid call to sleep> sleep () - %!error <Invalid call to sleep> sleep (1, 2) %!test @@ -56,7 +55,6 @@ %! assert (__prog_output_assert__ ("ok")); %!error <Invalid call to usleep> usleep () - %!error <Invalid call to usleep> usleep (1, 2) %!test @@ -78,7 +76,6 @@ %! endif %!error <Invalid call to rename> rename () - %!error <Invalid call to rename> rename ("foo", "bar", 1) %!test @@ -92,7 +89,6 @@ %! endif %!error <Invalid call to unlink> unlink () - %!error <Invalid call to unlink> unlink ("foo", 1) %!test @@ -100,7 +96,6 @@ %! assert (iscell (files) && status == 0 && strcmp (msg, "")); %!error <Invalid call to readdir> readdir () - %!error <Invalid call to readdir> readdir ("foo", 1) %!test @@ -112,9 +107,7 @@ %! assert ((e1 && strcmp (s2.modestr(1), "d") && e3 && e4 < 0)); %!error <Invalid call to mkdir> mkdir () - %!error <Invalid call to mkdir> mkdir ("foo", 1, 2) - %!error <Invalid call to rmdir> rmdir () %!test @@ -124,27 +117,29 @@ %! confirm_recursive_rmdir (crr); %!test -%! orig_umask = umask (0); -%! nm = tmpnam (); -%! id = fopen (nm, "wb"); -%! s1 = stat (nm); -%! fclose (id); -%! unlink (nm); +%! ## Test makes no sense on Windows systems +%! if (isunix () || ismac ()) +%! orig_umask = umask (0); +%! nm = tmpnam (); +%! id = fopen (nm, "wb"); +%! s1 = stat (nm); +%! fclose (id); +%! unlink (nm); %! -%! umask (777); -%! nm = tmpnam (); -%! id = fopen (nm, "wb"); -%! s2 = stat (nm); -%! fclose (id); -%! unlink (nm); +%! umask (777); +%! nm = tmpnam (); +%! id = fopen (nm, "wb"); +%! s2 = stat (nm); +%! fclose (id); +%! unlink (nm); %! -%! assert (deblank (s1.modestr), "-rw-rw-rw-"); -%! assert (deblank (s2.modestr), "----------"); -%! ## Restore original umask value -%! umask (orig_umask); +%! assert (deblank (s1.modestr), "-rw-rw-rw-"); +%! assert (deblank (s2.modestr), "----------"); +%! ## Restore original umask value +%! umask (orig_umask); +%! endif %!error <Invalid call to umask> umask () - %!error <Invalid call to umask> umask (1, 2) %!test @@ -164,7 +159,6 @@ %! && ischar (msg))); %!error <Invalid call to stat> stat () - %!error <Invalid call to stat> stat ("foo", 1) %!test @@ -184,13 +178,11 @@ %! && ischar (msg))); %!error <Invalid call to lstat> lstat () - %!error <Invalid call to lstat> lstat ("foo", 1) %!assert (iscell (glob ([filesep "*"]))) %!error <Invalid call to glob> glob () - %!error <Invalid call to glob> glob ("foo", 1) %!test @@ -202,25 +194,21 @@ %! && fnmatch ("x???y", {"xabcy"; "xy"}) == [1; 0])); %!error <Invalid call to fnmatch> fnmatch () - %!error <Invalid call to fnmatch> fnmatch ("foo", "bar", 3) %!assert (ischar (file_in_path (path (), "date.m"))) %!error <invalid option> file_in_path ("foo", "bar", 1) - %!error <Invalid call to file_in_path> file_in_path () - %!error <Invalid call to file_in_path> file_in_path ("foo", "bar", "baz", "ooka") %!testif HAVE_GETPWUID %! x = getpwuid (getuid ()); -%! assert ((strcmp (x.dir, tilde_expand ("~")) -%! && strcmp (x.dir, tilde_expand (sprintf ("~%s", x.name))) -%! && strcmp ("foobar", tilde_expand ("foobar")))); +%! assert (x.dir, tilde_expand ("~")); +%! assert (x.dir, tilde_expand (sprintf ("~%s", x.name))); +%! assert ("foobar", tilde_expand ("foobar")); %!error <Invalid call to tilde_expand> tilde_expand () - %!error <Invalid call to tilde_expand> tilde_expand ("str", 2) %!testif HAVE_GETPGRP @@ -256,7 +244,6 @@ %!assert (getenv ("HOME"), tilde_expand ("~")) %!error <Invalid call to getenv> getenv () - %!error <Invalid call to getenv> getenv ("foo", 1) %!test @@ -270,7 +257,6 @@ %! assert (getenv ("foobar"), "baz"); %!error <Invalid call to putenv> putenv () - %!error <Invalid call to putenv> putenv ("foo", "bar", 1) %!test @@ -319,7 +305,6 @@ %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); %!error <Invalid call to getpwuid> getpwuid () - %!error <Invalid call to getpwuid> getpwuid (1, 2) %!testif HAVE_GETPWNAM @@ -329,7 +314,6 @@ %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); %!error <Invalid call to getpwnam> getpwnam () - %!error <Invalid call to getpwnam> getpwnam ("foo", 1) %!testif HAVE_SETPWENT @@ -340,7 +324,6 @@ %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); %!error <Invalid call to setpwent> setpwent (1) - %!error <Invalid call to endpwent> endpwent (1) %!testif HAVE_GETGRENT @@ -361,7 +344,6 @@ %! assert (strcmp (x.name, y.name) && x.gid == y.gid); %!error <Invalid call to getgrgid> getgrgid () - %!error <Invalid call to getgrgid> getgrgid (1, 2) %!testif HAVE_GETGRNAM @@ -371,7 +353,6 @@ %! assert (strcmp (x.name, y.name) && x.gid == y.gid); %!error <Invalid call to getgrnam> getgrnam () - %!error <Invalid call to getgrnam> getgrnam ("foo", 1) %!testif HAVE_SETGRENT @@ -382,7 +363,6 @@ %! assert (strcmp (x.name, y.name) && x.gid == y.gid); %!error <Invalid call to setgrent> setgrent (1) - %!error <Invalid call to endgrent> endgrent (1) %!assert (isieee () == 1 || isieee () == 0)