Handle PERLIO= and document a bit.
[p5sagit/p5-mst-13.2.git] / t / op / split.t
index 5b8535c..17ab1e6 100755 (executable)
@@ -6,7 +6,7 @@ BEGIN {
     require './test.pl';
 }
 
-plan tests => 49;
+plan tests => 54;
 
 $FS = ':';
 
@@ -265,14 +265,27 @@ ok(@ary == 3 &&
 
 {
     # [perl #18195]
-    for my $a (0,1) {
-       $_ = 'readin,database,readout';
-       if ($ARGV[0])  {
-           $_ .= chr 256;
-           chop;
+    for my $u (0, 1) {
+       for my $a (0, 1) {
+           $_ = 'readin,database,readout';
+           utf8::upgrade $_ if $u;
+           /(.+)/;
+           my @d = split /[,]/,$1;
+           is(join (':',@d), 'readin:database:readout', "[perl #18195]");
        }
-       /(.+)/;
-       my @d = split /[,]/,$1;
-       is(join (':',@d), 'readin:database:readout', "[perl #18195]")
     }
 }
+
+{
+    $p="a,b";
+    utf8::upgrade $p;
+    eval { @a=split(/[, ]+/,$p) };
+    is ("$@-@a-", '-a b-', '#20912 - split() to array with /[]+/ and utf8');
+}
+
+{
+    is (\@a, \@{"a"}, '@a must be global for following test');
+    $p="";
+    $n = @a = split /,/,$p;
+    is ($n, 0, '#21765 - pmreplroot hack used to return undef for 0 iters');
+}