Debian Codegraph @

t/ree-pcre/capture.t

raw
1 use strict;
2
3 use Test::More tests => 20;
4
5 use re::engine::RE2;
6
7 unless ("eep aoeu 420 eek" =~ /(.)(.)(.)(.) ([0-9]+)/) {
8 fail "didn't match";
9 } else {
10 is($`, "eep ");
11 is($', " eek");
12 is($&, "aoeu 420", '$&');
13
14 is($1, "a", '$1 = a');
15 is($2, "o", '$2 = o');
16 is($3, "e", '$3 = e');
17 is($4, "u", '$4 = u');
18 is($5, "420", '$5 = 420');
19 is($6, undef, '$6 = undef');
20 is($640, undef, '$640 = undef');
21 }
22
23 unless ("aoeuhtns" =~ /(.)(.)(.)(.)/g) {
24 fail "didn't match";
25 } else {
26 is($1, "a");
27 is($2, "o");
28 is($3, "e");
29 is($4, "u");
30 is($5, undef);
31 is($6, undef);
32 is($7, undef);
33 is($8, undef);
34 }
35
36 my ($a, $b) = "ab" =~ /(.)/g;
37 is($a, "a");
38 is($b, "b");
39