File: one_liner.t

package info (click to toggle)
libregexp-grammars-perl 1.058-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,328 kB
  • sloc: perl: 53,328; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 843 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use 5.010;
use Test::More 'no_plan';

use Regexp::Grammars;

my $grammar_noRG  = qr{^a b$};
my $grammar_top   = qr{ ^ a b $ <rule: unused> };
my $grammar_rule  = qr{ <Rule>  <rule: Rule> ^ <let> <let> $ <token: let> \w};
my $grammar_token = qr{ <Token> <token: Token> ^ <let> <let> $ <token: let> \w};

ok 'ab'  !~ $grammar_noRG => 'No RG correctly fails without space';
ok 'a b' =~ $grammar_noRG => 'No RG correctly matches with space';

ok 'ab'  =~ $grammar_top => 'Top correctly matches without space';
ok 'a b' !~ $grammar_top => 'Top correctly fails with space';

ok 'ab'  =~ $grammar_token => 'Token correctly matches without space';
ok 'a b' !~ $grammar_token => 'Token correctly fails with space';

ok 'ab'  =~ $grammar_rule => 'Rule correctly matches without space';
ok 'a b' =~ $grammar_rule => 'Rule correctly matches with space';