summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorunknown <mauzo@.(none)>2009-03-26 15:25:19 +0000
committerunknown <mauzo@.(none)>2009-03-26 15:25:19 +0000
commitfa7f7498c3a31a48b9bcf12853629ed5411ddb45 (patch)
tree748e2cd0212d8b8d44e0fe78d21e4ef5a1f0c20d /t
parent500ff13f1832355fdcc9d1bd6d9c3f8ba9d02398 (diff)
downloadperl-fa7f7498c3a31a48b9bcf12853629ed5411ddb45.tar.gz
-ugk don't call string overload when S_IXXX isn't defined.
Diffstat (limited to 't')
-rwxr-xr-xt/op/filetest.t15
1 files changed, 13 insertions, 2 deletions
diff --git a/t/op/filetest.t b/t/op/filetest.t
index b025b48670..4678f9285e 100755
--- a/t/op/filetest.t
+++ b/t/op/filetest.t
@@ -143,6 +143,8 @@ open my $io, "<", "TEST";
$io = *{$io}{IO};
bless $io, "OverString";
+eval { require Fcntl };
+
for my $op (split //, "rwxoRWXOezsfdlpSbctugkTMBAC") {
$over = [];
ok( my $rv = eval "-$op \$ft", "overloaded -$op succeeds" )
@@ -151,14 +153,23 @@ for my $op (split //, "rwxoRWXOezsfdlpSbctugkTMBAC") {
is( $over->[1], $op, "correct op for overloaded -$op" );
is( $rv, "-$op", "correct return value for overloaded -$op");
+ my ($exp, $is) = (1, "is");
+ if (
+ $op eq "u" and not eval { Fcntl::S_ISUID() } or
+ $op eq "g" and not eval { Fcntl::S_ISGID() } or
+ $op eq "k" and not eval { Fcntl::S_ISVTX() }
+ ) {
+ ($exp, $is) = (0, "not");
+ }
+
$over = 0;
$rv = eval "-$op \$str";
ok( !$@, "-$op succeeds with string overloading" )
or diag( $@ );
is( $rv, eval "-$op 'TEST'", "correct -$op on string overload" );
- is( $over, 1, "string overload called for -$op" );
+ is( $over, $exp, "string overload $is called for -$op" );
- my ($exp, $is) = $op eq "l" ? (1, "is") : (0, "not");
+ ($exp, $is) = $op eq "l" ? (1, "is") : (0, "not");
$over = 0;
eval "-$op \$gv";