X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fsplit.t;h=4144bbb88f4ecef25d2bb0e955ffbb1aeea8f609;hb=7a4c00b4303a05a04564a03a88f4fa5c7a06a6e9;hp=d87998e0986097a93d792d02eb1fdb089f2b8a3b;hpb=79072805bf63abe5b5978b5928ab00d360ea3e7f;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/split.t b/t/op/split.t index d87998e..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 = ':'; @@ -48,6 +48,9 @@ print $_ eq '1:2:3:4:5:6:::' ? "ok 10\n" : "not ok 10 $_\n"; # Does assignment to a list imply split to one more field than that? $foo = `./perl -D1024 -e '(\$a,\$b) = split;' 2>&1`; +if ($foo =~ /DCL-W-NOCOMD/) { + $foo = `\$ mcr sys\$disk:[]perl. "-D1024" -e "(\$a,\$b) = split;"`; +} print $foo =~ /DEBUGGING/ || $foo =~ /SV = IV\(3\)/ ? "ok 11\n" : "not ok 11\n"; # Can we say how many fields to split to when assigning to a list? @@ -55,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";