Upgrade to Tie::File 0.20.
[p5sagit/p5-mst-13.2.git] / t / op / stat.t
index 2f38719..9306d2f 100755 (executable)
@@ -9,7 +9,7 @@ BEGIN {
 use Config;
 use File::Spec;
 
-plan tests => 74;
+plan tests => 73;
 
 my $Perl = which_perl();
 
@@ -22,6 +22,7 @@ $Is_NetWare = $^O eq 'NetWare';
 $Is_OS2     = $^O eq 'os2';
 $Is_Solaris = $^O eq 'solaris';
 $Is_VMS     = $^O eq 'VMS';
+$Is_DGUX    = $^O eq 'dgux';
 
 $Is_Dosish  = $Is_Dos || $Is_OS2 || $Is_MSWin32 || $Is_NetWare || $Is_Cygwin;
 
@@ -106,6 +107,8 @@ SKIP: {
 # Check if you are on a tmpfs of some sort.  Building in /tmp sometimes
 # has this problem.  Also building on the ClearCase VOBS filesystem may
 # cause this failure.
+# Darwins UFS doesn't have a ctime concept, and thus is
+# expected to fail this test.
 DIAG
         }
     }
@@ -198,20 +201,20 @@ unlink($tmpfile_link);
 ok(! -e $tmpfile_link,  '   -e on unlinked file');
 
 SKIP: {
-    skip "No character, socket or block special files", 3
+    skip "No character, socket or block special files", 6
       if $Is_MSWin32 || $Is_NetWare || $Is_Dos;
-    skip "/dev isn't available to test against", 3
+    skip "/dev isn't available to test against", 6
       unless -d '/dev' && -r '/dev' && -x '/dev';
 
     my $LS  = $Config{d_readlink} ? "ls -lL" : "ls -l";
     my $CMD = "$LS /dev 2>/dev/null";
     my $DEV = qx($CMD);
 
-    skip "$CMD failed", 3 if $DEV eq '';
+    skip "$CMD failed", 6 if $DEV eq '';
 
     my @DEV = do { my $dev; opendir($dev, "/dev") ? readdir($dev) : () };
 
-    skip "opendir failed: $!", 3 if @DEV == 0;
+    skip "opendir failed: $!", 6 if @DEV == 0;
 
     # /dev/stdout might be either character special or a named pipe,
     # or a symlink, or a socket, depending on which OS and how are
@@ -241,15 +244,21 @@ SKIP: {
        is($c1, $c2, "ls and $_[1] agreeing on /dev ($c1 $c2)");
     };
 
+SKIP: {
+    skip("DG/UX ls -L broken", 3) if $Is_DGUX;
+
     $try->('b', '-b');
     $try->('c', '-c');
     $try->('s', '-S');
+
 }
 
 ok(! -b $Curdir,    '!-b cwd');
 ok(! -c $Curdir,    '!-c cwd');
 ok(! -S $Curdir,    '!-S cwd');
 
+}
+
 SKIP: {
     my($cnt, $uid);
     $cnt = $uid = 0;
@@ -320,7 +329,11 @@ SKIP: {
 ok(-T 'op/stat.t',      '-T');
 ok(! -B 'op/stat.t',    '!-B');
 
+SKIP: {
+     skip("DG/UX", 1) if $Is_DGUX;
 ok(-B $Perl,      '-B');
+}
+
 ok(! -T $Perl,    '!-T');
 
 open(FOO,'op/stat.t');
@@ -334,14 +347,14 @@ SKIP: {
     ok(! -B FOO,    '   !-B');
 
     $_ = <FOO>;
-    ok(/perl/,      'after readline');
+    like($_, qr/perl/, 'after readline');
     ok(-T FOO,      '   still -T');
     ok(! -B FOO,    '   still -B');
     close(FOO);
 
     open(FOO,'op/stat.t');
     $_ = <FOO>;
-    ok(/perl/,      'reopened and after readline');
+    like($_, qr/perl/,      'reopened and after readline');
     ok(-T FOO,      '   still -T');
     ok(! -B FOO,    '   still !-B');
 
@@ -378,20 +391,16 @@ my @r = \stat(".");
 is(scalar @r, 13,   'stat returns full 13 elements');
 
 SKIP: {
-    skip "No lstat", 2 unless $Config{d_lstat};
+    skip "No lstat", 4 unless $Config{d_lstat};
 
     stat $0;
     eval { lstat _ };
-    ok( $@ =~ /^The stat preceding lstat\(\) wasn't an lstat/,
+    like( $@, qr/^The stat preceding lstat\(\) wasn't an lstat/,
        'lstat _ croaks after stat' );
     eval { -l _ };
-    ok( $@ =~ /^The stat preceding -l _ wasn't an lstat/,
+    like( $@, qr/^The stat preceding -l _ wasn't an lstat/,
        '-l _ croaks after stat' );
 
-    eval { lstat STDIN };
-    ok( $@ =~ /^The stat preceding lstat\(\) wasn't an lstat/,
-       'lstat FILEHANDLE croaks' );
-
     # bug id 20020124.004
     # If we have d_lstat, we should have symlink()
     my $linkname = 'dolzero';
@@ -399,10 +408,10 @@ SKIP: {
     lstat $linkname;
     -T _;
     eval { lstat _ };
-    ok( $@ =~ /^The stat preceding lstat\(\) wasn't an lstat/,
+    like( $@, qr/^The stat preceding lstat\(\) wasn't an lstat/,
        'lstat croaks after -T _' );
     eval { -l _ };
-    ok( $@ =~ /^The stat preceding -l _ wasn't an lstat/,
+    like( $@, qr/^The stat preceding -l _ wasn't an lstat/,
        '-l _ croaks after -T _' );
     unlink $linkname or print "# unlink $linkname failed: $!\n";
 }