From: Perl 5 Porters Date: Sun, 25 Aug 1996 00:14:19 +0000 (+0000) Subject: perl 5.003_03: t/op/split.t X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=084811a77fe079a567456c8e5f1787f4dd137226;p=p5sagit%2Fp5-mst-13.2.git perl 5.003_03: t/op/split.t If a regex supplied to split() contains paranthesized subpatterns that can result in null matches, perl coredumps. --- diff --git a/t/op/split.t b/t/op/split.t index 2354530..4144bbb 100755 --- a/t/op/split.t +++ b/t/op/split.t @@ -2,7 +2,7 @@ # $RCSfile: split.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:26 $ -print "1..12\n"; +print "1..14\n"; $FS = ':'; @@ -58,3 +58,10 @@ print $foo =~ /DEBUGGING/ || $foo =~ /SV = IV\(3\)/ ? "ok 11\n" : "not ok 11\n"; $_ = join(':',$a,$b); print $_ eq '1:2 3 4 5 6' ? "ok 12\n" : "not ok 12 $_\n"; +# do subpatterns generate additional fields (without trailing nulls)? +$_ = join '|', split(/,|(-)/, "1-10,20,,,"); +print $_ eq "1|-|10||20" ? "ok 13\n" : "not ok 13\n"; + +# do subpatterns generate additional fields (with a limit)? +$_ = join '|', split(/,|(-)/, "1-10,20,,,", 10); +print $_ eq "1|-|10||20||||||" ? "ok 14\n" : "not ok 14\n";