summaryrefslogtreecommitdiff
path: root/t/op/tie.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-10-28 01:44:31 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-10-28 02:04:58 -0700
commit0960ff5ae77d081b538d8f0690367bb5144cf1c1 (patch)
tree71a74f76100f68dfb29ebe268827bbb76c06f3ad /t/op/tie.t
parentc06ecf4f38015d4985dd5994aebe5c15908d2f26 (diff)
downloadperl-0960ff5ae77d081b538d8f0690367bb5144cf1c1.tar.gz
Don’t skip tied EXISTS for negative array indices
This was broken in 5.14.0 for those cases where $NEGATIVE_INDICES is not true: sub TIEARRAY{bless[]}; sub FETCHSIZE { 50 } sub EXISTS { print "does $_[1] exist?\n" } tie @a, ""; exists $a[1]; exists $a[-1]; $NEGATIVE_INDICES=1; exists $a[-1]; $ pbpaste|perl5.12.0 does 1 exist? does 49 exist? does -1 exist? $ pbpaste|perl5.14.0 does 1 exist? does -1 exist? This was broken by 54a4274e3c.
Diffstat (limited to 't/op/tie.t')
-rw-r--r--t/op/tie.t15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/op/tie.t b/t/op/tie.t
index 5808a09524..83f10dd5ac 100644
--- a/t/op/tie.t
+++ b/t/op/tie.t
@@ -1302,3 +1302,18 @@ each %$h;
delete $$h{foo};
tie %$h, 'l';
EXPECT
+########
+
+# NAME EXISTS on arrays
+sub TIEARRAY{bless[]};
+sub FETCHSIZE { 50 }
+sub EXISTS { print "does $_[1] exist?\n" }
+tie @a, "";
+exists $a[1];
+exists $a[-1];
+$NEGATIVE_INDICES=1;
+exists $a[-1];
+EXPECT
+does 1 exist?
+does 49 exist?
+does -1 exist?