This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regmatch(): do nextchr=*locinput at top of loop
[perl5.git] / t / io / fs.t
index f5de9c5..26208c1 100644 (file)
--- a/t/io/fs.t
+++ b/t/io/fs.t
@@ -7,9 +7,7 @@ BEGIN {
 }
 
 use Config;
-use File::Spec::Functions;
 
-my $Is_MacOS  = ($^O eq 'MacOS');
 my $Is_VMSish = ($^O eq 'VMS');
 
 if (($^O eq 'MSWin32') || ($^O eq 'NetWare')) {
@@ -28,7 +26,7 @@ my $accurate_timestamps =
     !($^O eq 'MSWin32' || $^O eq 'NetWare' ||
       $^O eq 'dos'     || $^O eq 'os2'     ||
       $^O eq 'cygwin'  || $^O eq 'amigaos' ||
-         $wd =~ m#$Config{afsroot}/# || $Is_MacOS
+         $wd =~ m#$Config{afsroot}/#
      );
 
 if (defined &Win32::IsWinNT && Win32::IsWinNT()) {
@@ -48,7 +46,7 @@ $needs_fh_reopen = 1 if (defined &Win32::IsWin95 && Win32::IsWin95());
 my $skip_mode_checks =
     $^O eq 'cygwin' && $ENV{CYGWIN} !~ /ntsec/;
 
-plan tests => 51;
+plan tests => 52;
 
 my $tmpdir = tempfile();
 my $tmpdir1 = tempfile();
@@ -63,21 +61,18 @@ elsif ($^O eq 'VMS') {
     `if f\$search("$tmpdir.dir") .nes. "" then delete/nolog/noconfirm $tmpdir.dir;`;
     `create/directory [.$tmpdir]`;
 }
-elsif ($Is_MacOS) {
-    rmdir "$tmpdir"; mkdir "$tmpdir";
-}
 else {
     `rm -f $tmpdir 2>/dev/null; mkdir $tmpdir 2>/dev/null`;
 }
 
-chdir catdir(curdir(), $tmpdir);
+chdir $tmpdir;
 
 `/bin/rm -rf a b c x` if -x '/bin/rm';
 
 umask(022);
 
 SKIP: {
-    skip "bogus umask", 1 if ($^O eq 'MSWin32') || ($^O eq 'NetWare') || ($^O eq 'epoc') || $Is_MacOS;
+    skip "bogus umask", 1 if ($^O eq 'MSWin32') || ($^O eq 'NetWare') || ($^O eq 'epoc');
 
     is((umask(0)&0777), 022, 'umask'),
 }
@@ -377,7 +372,7 @@ SKIP: {
 
     SKIP: {
         if ($^O eq 'vos') {
-           skip ("# TODO - hit VOS bug posix-973 - cannot resize an open file below the current file pos.", 5);
+           skip ("# TODO - hit VOS bug posix-973 - cannot resize an open file below the current file pos.", 6);
        }
 
        is(-s $tmpfile, 200, "fh resize to 200 working (filename check)");
@@ -412,6 +407,14 @@ SKIP: {
        is(-s $tmpfile, 100, "fh resize by IO slot working");
 
        close FH;
+
+       my $n = "for_fs_dot_t$$";
+       open FH, ">$n" or die "open $n: $!";
+       print FH "bloh blah bla\n";
+       close FH or die "close $n: $!";
+       eval "truncate $n, 0; 1" or die;
+       ok !-z $n, 'truncate(word) does not fall back to file name';
+       unlink $n;
     }
 }
 
@@ -428,7 +431,7 @@ SKIP: {
     # this works on win32 only, because fs isn't casesensitive
     ok(-e 'X', "rename working");
 
-    1 while unlink 'X';
+    unlink_all 'X';
     chdir $wd || die "Can't cd back to $wd";
 }