Debian Codegraph @

t/ree-pcre/split.t

raw
1 use strict;
2 use Test::More tests => 20;
3 use re::engine::RE2;
4
5 {
6 my ($a, $b, $c) = split /(:)/, "a:b";
7 is($a, "a");
8 is($b, ":");
9 is($c, "b");
10 }
11
12 # The " " special case
13 {
14 my ($a, $b, $c, $d, $e) = split " ", " foo bar zar ";
15 is($a, "foo");
16 is($b, "bar");
17 is($c, "zar");
18 is($d, "");
19 is($e, undef);
20 }
21
22 # The /^/ special case
23 {
24 my ($a, $b, $c) = split /^/, "a\nb\nc\n";
25 is($a, "a\n");
26 is($b, "b\n");
27 is($c, "c\n");
28 }
29
30 # The /\s+/ special case
31 {
32 my ($a, $b, $c, $d) = split /\s+/, "a b c\t d";
33 is($a, "a");
34 is($b, "b");
35 is($c, "c");
36 is($d, "d");
37 }
38
39 {
40 my ($a, $b, $c, $d, $e) = split / /, " x y ";
41 is($a, "");
42 is($b, "x");
43 is($c, "y");
44 is($d, "");
45 is($e, undef);
46 }