summaryrefslogtreecommitdiff
path: root/lib/File
diff options
context:
space:
mode:
authorBen Morrow <ben@morrow.me.uk>2009-01-20 03:01:37 +0000
committerBen Morrow <ben@morrow.me.uk>2009-03-25 21:14:07 +0000
commitcd22a09c8c81e5e4c639c15ad19704a0d1e0c842 (patch)
tree9cc41f9d76120eece3b3547ecfc58b79b5448bcc /lib/File
parent709edd5bfab4664ea90ed1988a3465afffc3420b (diff)
downloadperl-cd22a09c8c81e5e4c639c15ad19704a0d1e0c842.tar.gz
Tests for -X overload on File::stat.
Diffstat (limited to 'lib/File')
-rw-r--r--lib/File/stat.t22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/File/stat.t b/lib/File/stat.t
index 23594539d0..b1c4b9f2de 100644
--- a/lib/File/stat.t
+++ b/lib/File/stat.t
@@ -19,7 +19,7 @@ BEGIN {
unless (@stat) { plan skip_all => "1..0 # Skip: no file TEST"; exit 0 }
}
-plan tests => 19;
+plan tests => 19 + 24*2 + 3;
use_ok( 'File::stat' );
@@ -56,6 +56,23 @@ is( $stat->blksize, $stat[11], "IO block size in position 11" );
is( $stat->blocks, $stat[12], "number of blocks in position 12" );
+for (split //, "rwxoRWXOezsfdlpSbcugkMCA") {
+ SKIP: {
+ $^O eq "VMS" and index "rwxRWX", $_
+ and skip "File::stat ignores VMS ACLs", 1;
+
+ my $rv = eval "-$_ \$stat";
+ ok( !$@, "-$_ overload succeeds" )
+ or diag( $@ );
+ is( $rv, eval "-$_ 'TEST'", "correct -$_ overload" );
+ }
+}
+
+for (split //, "tTB") {
+ eval "-$_ \$stat";
+ like( $@, qr/\Q-$_ is not implemented/, "-$_ overload fails" );
+}
+
SKIP: {
local *STAT;
skip("Could not open file: $!", 2) unless open(STAT, 'TEST');
@@ -81,8 +98,9 @@ SKIP: {
main::is( "@$stat", "@$stat3", '... and must match normal stat' );
}
+
local $!;
$stat = stat '/notafile';
-isn't( $!, '', 'should populate $!, given invalid file' );
+isnt( $!, '', 'should populate $!, given invalid file' );
# Testing pretty much anything else is unportable.