set_up_inc('../lib');
}
-plan tests => 176;
+plan tests => 178;
$FS = ':';
$cnt = split(' ','1 2 3 4 5 6', $x);
is($cnt, scalar(@ary), "Check element count from previous test");
+# Can we do it with the empty pattern?
+$_ = join(':', split(//, '123', 2));
+is($_, '1:23', "Split into specified number of fields with empty pattern");
+@ary = split(//, '123', 2);
+$cnt = split(//, '123', 2);
+is($cnt, scalar(@ary), "Check element count from previous test");
+
# Does the 999 suppress null field chopping?
$_ = join(':', split(/:/,'1:2:3:4:5:6:::', 999));
is($_ , '1:2:3:4:5:6:::');
}
skip_all_if_miniperl("no dynamic loading on miniperl, no File::Spec (used by charnames)");
-plan(tests => 145);
+plan(tests => 147);
{
# check the special casing of split /\s/ and unicode
}
}
+
+{
+ # Check empty pattern with specified field count on Unicode string
+ my $string = "\x{100}\x{101}\x{102}";
+ $_ = join(':', split(//, $string, 2));
+ is($_, "\x{100}:\x{101}\x{102}",
+ "Split into specified number of fields with empty pattern");
+ @ary = split(//, $string, 2);
+ $cnt = split(//, $string, 2);
+ is($cnt, scalar(@ary), "Check element count from previous test");
+}