[perl #111638] TODO for -p on a File::stat object
authorTony Cook <tony@develop-help.com>
Tue, 20 Mar 2012 06:35:42 +0000 (17:35 +1100)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 22 May 2012 00:51:55 +0000 (17:51 -0700)
lib/File/stat.t

index 32a7481..382f43e 100644 (file)
@@ -42,7 +42,7 @@ BEGIN {
 our @stat = stat $file; # This is the function stat.
 unless (@stat) { plan skip_all => "1..0 # Skip: no file $file"; exit 0 }
 
-plan tests => 19 + 24*2 + 4 + 3 + 7;
+plan tests => 19 + 24*2 + 4 + 3 + 7 + 2;
 
 use_ok( 'File::stat' );
 
@@ -159,6 +159,20 @@ SKIP: {
     }
 }
 
+SKIP:
+{   # RT #111638
+    skip "We can't check for FIFOs", 2 unless defined &Fcntl::S_ISFIFO;
+    skip "No pipes", 2 unless defined $Config{d_pipe};
+    pipe my ($rh, $wh)
+      or skip "Couldn't create a pipe: $!", 2;
+    skip "Built-in -p doesn't detect a pipe", 2 unless -p $rh;
+
+    my $pstat = File::stat::stat($rh);
+    ok(!-p($stat), "-p should be false on a file");
+    local $TODO = "RT #111638 -p overload broken";
+    ok(-p($pstat), "check -p detects a pipe");
+}
+
 local $!;
 $stat = stat '/notafile';
 isnt( $!, '', 'should populate $!, given invalid file' );