summaryrefslogtreecommitdiff
path: root/t/op/filetest.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-09-10 19:47:59 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-09-10 21:46:51 -0700
commit49498cafba9ef826af2f85193bb77c26f9efbe77 (patch)
treeb273ce2b856fbb333d01a97c8898b15a17e7649f /t/op/filetest.t
parent094a3eec8ad4cfb12d72a98f11e9186594579b57 (diff)
downloadperl-49498cafba9ef826af2f85193bb77c26f9efbe77.tar.gz
Stop filetest ops from calling FETCH on parent op’s arg
This is a regression in 5.14.0. Commit 6f1401dc made ops call get-magic before overloading, but it ended up making filetest ops call get-magic on the topmost item of the stack even if the filetest op was not going to use the stack (which happens for ‘-r bareword’ and plain ‘-r’). This would affect cases like: push @foo, $tied, -r;
Diffstat (limited to 't/op/filetest.t')
-rw-r--r--t/op/filetest.t13
1 files changed, 12 insertions, 1 deletions
diff --git a/t/op/filetest.t b/t/op/filetest.t
index a6d62ed320..08380d1c97 100644
--- a/t/op/filetest.t
+++ b/t/op/filetest.t
@@ -10,7 +10,7 @@ BEGIN {
}
use Config;
-plan(tests => 29 + 27*14);
+plan(tests => 30 + 27*14);
ok( -d 'op' );
ok( -f 'TEST' );
@@ -204,3 +204,14 @@ for my $op (split //, "rwxoRWXOezsfdlpSbctugkTMBAC") {
push my @foo, "bar", -l baz;
is $foo[0], "bar", '-l bareword does not corrupt the stack';
}
+
+# File test ops should not call get-magic on the topmost SV on the stack if
+# it belongs to another op.
+{
+ my $w;
+ sub oon::TIESCALAR{bless[],'oon'}
+ sub oon::FETCH{$w++}
+ tie my $t, 'oon';
+ push my @a, $t, -t;
+ is $w, 1, 'file test does not call FETCH on stack item not its own';
+}