summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2012-03-12 19:39:14 +1100
committerFather Chrysostomos <sprout@cpan.org>2012-05-21 17:51:52 -0700
commit606cb3b3e186516d9d621a26778dd24bdd30ed0a (patch)
tree1fda0be1bbcc4ff8cd00938f444c20849f19c925
parent8e629ff434d89810db5682216773576e5a345702 (diff)
downloadperl-606cb3b3e186516d9d621a26778dd24bdd30ed0a.tar.gz
[rt #111640] TODO tests for warnings from -X on File::stat
-rw-r--r--lib/File/stat.t26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/File/stat.t b/lib/File/stat.t
index 0646ebdcd6..74bf5fb6b8 100644
--- a/lib/File/stat.t
+++ b/lib/File/stat.t
@@ -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;
+plan tests => 19 + 24*2 + 4 + 3 + 7;
use_ok( 'File::stat' );
@@ -136,6 +136,30 @@ SKIP: {
main::is( "@$stat", "@$stat3", '... and must match normal stat' );
}
+{ # 111640 - File::stat bogus index check in overload
+ # 7 tests in this block
+
+ use filetest "access";
+ use warnings;
+ for my $op (split //, "rwxRXW") {
+ local $TODO = $op eq "r" ? "RT 111640" : "";
+ # these should all warn with filetest access
+ my $w;
+ local $SIG{__WARN__} = sub { $w = shift };
+ eval "-$op \$stat";
+ like($w, qr/^File::stat ignores use filetest 'access'/,
+ "-$op produced the right warning under use filetest 'access'");
+ }
+
+ {
+ local $TODO = "RT 111640";
+ # -d and others shouldn't warn
+ my $w;
+ local $SIG{__WARN__} = sub { $w = shift };
+ eval '-d $stat';
+ is($w, undef, "Should be no warning from -d under filetest access");
+ }
+}
local $!;
$stat = stat '/notafile';