Re: Why *not* use UNIVERSAL qw( isa can ) ; ??
[p5sagit/p5-mst-13.2.git] / t / op / split.t
index ce8d64d..f9c3bb9 100755 (executable)
@@ -1,6 +1,11 @@
 #!./perl
 
-print "1..44\n";
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+}
+
+print "1..46\n";
 
 $FS = ':';
 
@@ -46,7 +51,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?
 if ($^O eq 'MSWin32') { $foo = `.\\perl -D1024 -e "(\$a,\$b) = split;" 2>&1` }
+elsif ($^O eq 'NetWare') { $foo = `perl -D1024 -e "(\$a,\$b) = split;" 2>&1` }
 elsif ($^O eq 'VMS')  { $foo = `./perl "-D1024" -e "(\$a,\$b) = split;" 2>&1` }
+elsif ($^O eq 'MacOS'){ $foo = `$^X "-D1024" -e "(\$a,\$b) = split;"` }
 else                  { $foo = `./perl -D1024 -e '(\$a,\$b) = split;' 2>&1` }
 print $foo =~ /DEBUGGING/ || $foo =~ /SV = (VOID|IV\(3\))/ ? "ok 11\n" : "not ok 11\n";
 
@@ -237,3 +244,24 @@ print "ok 32\n";
     print "ok 44\n";
 }
 
+{
+    # check that PMf_WHITE is cleared after \s+ is used
+    # reported in <20010627113312.RWGY6087.viemta06@localhost>
+    my $r;
+    foreach my $pat ( qr/\s+/, qr/ll/ ) {
+       $r = join ':' => split($pat, "hello cruel world");
+    }
+    print "not " unless $r eq "he:o cruel world";
+    print "ok 45\n";
+}
+
+
+{
+    # split /(A)|B/, "1B2" should return (1, undef, 2)
+    my @x = split /(A)|B/, "1B2";
+    print "not " unless
+      $x[0] eq '1' and
+      (not defined $x[1]) and
+      $x[2] eq '2';
+    print "ok 46\n";
+}