diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1996-08-25 00:14:19 +0000 |
---|---|---|
committer | Andy Dougherty <doughera@lafcol.lafayette.edu> | 1996-08-25 00:14:19 +0000 |
commit | 084811a77fe079a567456c8e5f1787f4dd137226 (patch) | |
tree | 5f1d5e44415f7b794bc60e81375401d3f0126f55 /t/op | |
parent | ddb9d9dc44a925e8debfb6b56dfdeb66a708607f (diff) | |
download | perl-084811a77fe079a567456c8e5f1787f4dd137226.tar.gz |
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.
Diffstat (limited to 't/op')
-rwxr-xr-x | t/op/split.t | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/t/op/split.t b/t/op/split.t index 2354530817..4144bbb88f 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"; |