travis-ci
1072 of 1372 relevant lines covered (78.13%)
11489.21 hits per line
1 |
use strict; |
10✔ |
2 |
use warnings; |
10✔ |
3 |
|
|
4 |
use Test::More tests => 1;
|
10✔ |
5 |
use Pegex; |
10✔ |
6 |
|
|
7 |
my $grammar = <<'...'; |
10✔ |
8 |
a: (((b)))+ |
|
9 |
b: (c | d) |
|
10 |
c: /(x)/ |
|
11 |
d: /y/ |
|
12 |
... |
|
13 |
|
|
14 |
{ |
|
15 |
package R; |
6✔ |
16 |
use base 'Pegex::Receiver'; |
10✔ |
17 |
sub got_a { |
|
18 |
my ($self, $got) = @_;
|
10✔ |
19 |
$self->flatten($got); |
10✔ |
20 |
$got; |
10✔ |
21 |
} |
|
22 |
sub got_b { |
|
23 |
my ($self, $got) = @_;
|
30✔ |
24 |
[$got]; |
30✔ |
25 |
} |
|
26 |
sub got_c { |
|
27 |
my ($self, $got) = @_;
|
30✔ |
28 |
[$got]; |
30✔ |
29 |
} |
|
30 |
} |
|
31 |
|
|
32 |
my $parser = pegex($grammar, 'R');
|
10✔ |
33 |
my $got = $parser->parse('xxx'); |
10✔ |
34 |
|
|
35 |
is join('', @$got), 'xxx', 'Array was flattened'; |
10✔ |