summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2006-12-29 22:45:51 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-01-04 14:30:02 +0000
commit44a2ac759eaf811ea851bdf9177a51bf9b95b5ce (patch)
treede91bdd2393df02ca17ddee82d06318cda92010e /t
parent1f2e791661e807f561a2d5dd8f2b6a4e339e444e (diff)
downloadperl-44a2ac759eaf811ea851bdf9177a51bf9b95b5ce.tar.gz
Re: [PATCH] Change implementation of %+ to use a proper tied hash interface and add support for %-
Message-ID: <9b18b3110612291245q792fe91cu69422d2b81bb4f0b@mail.gmail.com> p4raw-id: //depot/perl@29682
Diffstat (limited to 't')
-rwxr-xr-xt/op/pat.t21
1 files changed, 19 insertions, 2 deletions
diff --git a/t/op/pat.t b/t/op/pat.t
index 84dc2e85f7..24aa38a6df 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -3745,7 +3745,24 @@ sub iseq($$;$) {
';
ok(!$@,'lvalue $+{...} should not throw an exception');
}
-
+{
+ my $s='foo bar baz';
+ my @res;
+ if ('1234'=~/(?<A>1)(?<B>2)(?<A>3)(?<B>4)/) {
+ foreach my $name (sort keys(%-)) {
+ my $ary = $-{$name};
+ foreach my $idx (0..$#$ary) {
+ push @res,"$name:$idx:$ary->[$idx]";
+ }
+ }
+ }
+ my @expect=qw(A:0:1 A:1:3 B:0:2 B:1:4);
+ iseq("@res","@expect","Check %-");
+ eval'
+ print for $-{this_key_doesnt_exist};
+ ';
+ ok(!$@,'lvalue $-{...} should not throw an exception');
+}
# stress test CURLYX/WHILEM.
#
# This test includes varying levels of nesting, and according to
@@ -4240,7 +4257,7 @@ ok($@=~/\QSequence \k... not terminated in regex;\E/);
iseq(0+$::test,$::TestCount,"Got the right number of tests!");
# Don't forget to update this!
BEGIN {
- $::TestCount = 1606;
+ $::TestCount = 1608;
print "1..$::TestCount\n";
}