File: obj_rename.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 (30 lines) | stat: -rw-r--r-- 678 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
23
24
25
26
27
28
29
30
use 5.010;
use warnings;

use Test::More;
plan tests => 5;

use Regexp::Grammars;

my $list_nonempty = qr{
    <nocontext:>
    <List>

    <objrule: SaveAs=List>
        \(  <[Value]> ** (,)  \)

    <objtoken: Some::Other=Value>
        \d+
}xms;

#say $list_nonempty;

no Regexp::Grammars;

ok +('(1,2)' =~ $list_nonempty)           => 'Matched non-empty list';

is ref($/{List}), 'SaveAs'                => 'Class naming worked at top level';
ok ! exists $/{List}{q{}}                 => 'No top-level context';

is ref($/{List}{Value}[0]), 'Some::Other' => 'Class naming worked at 2nd level';
is ref($/{List}{Value}[1]), 'Some::Other' => 'Class naming again at 2nd level';