From 3914f56082a0817d46ec5706e82e48b4e4e19f9d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 9 Apr 2007 22:02:42 +0000 Subject: [PATCH] =?utf8?q?Re:=20[PATCH]=20length()=20on=20magic=20capture?= =?utf8?q?=20variables=20From:=20"=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmas?= =?utf8?q?on"=20=20Message-ID:=20<51dd1af80704091502m191?= =?utf8?q?30c28y29e6e656516fabfd@mail.gmail.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit p4raw-id: //depot/perl@30881 --- t/op/pat.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/op/pat.t b/t/op/pat.t index 6d3cafd..5512b2b 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -4411,11 +4411,23 @@ ok($@=~/\QSequence \k... not terminated in regex;\E/); iseq( (join ",", sort map "@$_", values %-), ",a" ); } +# length() on captures, these end up in Perl_magic_len +{ + my $_ = "aoeu \xe6var ook"; + /^ \w+ \s (?\S+)/x; + + iseq( length($`), 4, 'length $`' ); + iseq( length($'), 4, q[length $'] ); + iseq( length($&), 9, 'length $&' ); + iseq( length($1), 4, 'length $1' ); + iseq( length($+{eek}), 4, 'length $+{eek} == length $1' ); +} + # Put new tests above the dotted line about a page above this comment iseq(0+$::test,$::TestCount,"Got the right number of tests!"); # Don't forget to update this! BEGIN { - $::TestCount = 1658; + $::TestCount = 1663; print "1..$::TestCount\n"; } -- 2.7.4