SYN SYN
[p5sagit/p5-mst-13.2.git] / t / io / fs.t
index 0bcf579..7182c24 100755 (executable)
--- a/t/io/fs.t
+++ b/t/io/fs.t
@@ -4,7 +4,7 @@
 
 BEGIN {
     chdir 't' if -d 't';
-    unshift @INC, '../lib';
+    @INC = '../lib';
 }
 
 use Config;
@@ -16,12 +16,12 @@ if (defined &Win32::IsWinNT && Win32::IsWinNT()) {
     $Is_Dosish = '' if Win32::FsType() eq 'NTFS';
 }
 
-print "1..28\n";
+print "1..29\n";
 
 $wd = (($^O eq 'MSWin32') ? `cd` : `pwd`);
 chop($wd);
 
-if ($^O eq 'MSWin32') { `del tmp 2>nul`; `mkdir tmp`; }
+if ($^O eq 'MSWin32') { `rmdir /s /q tmp 2>nul`; `mkdir tmp`; }
 else {  `rm -f tmp 2>/dev/null; mkdir tmp 2>/dev/null`; }
 chdir './tmp';
 `/bin/rm -rf a b c x` if -x '/bin/rm';
@@ -104,6 +104,7 @@ if (rename('a','b')) {print "ok 14\n";} else {print "not ok 14\n";}
     $blksize,$blocks) = stat('a');
 if ($ino == 0) {print "ok 15\n";} else {print "not ok 15\n";}
 $delta = $Is_Dosish ? 2 : 1;   # Granularity of time on the filesystem
+chmod 0777, 'b';
 $foo = (utime 500000000,500000000 + $delta,'b');
 if ($foo == 1) {print "ok 16\n";} else {print "not ok 16 $foo\n";}
 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
@@ -177,10 +178,20 @@ else {
   close FH;
 }
 
+# check if rename() can be used to just change case of filename
+chdir './tmp';
+open(fh,'>x') || die "Can't create x";
+close(fh);
+rename('x', 'X');
+print 'not ' unless -e 'X';
+print "ok 27\n";
+unlink 'X';
+chdir $wd || die "Can't cd back to $wd";
+
 # check if rename() works on directories
 rename 'tmp', 'tmp1' or print "not ";
-print "ok 27\n";
--d 'tmp1' or print "not ";
 print "ok 28\n";
+-d 'tmp1' or print "not ";
+print "ok 29\n";
 
 END { rmdir 'tmp1'; unlink "Iofs.tmp"; }