File: scalar_attributes.t

package info (click to toggle)
libppr-perl 0.001010-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 932 kB
  • sloc: perl: 5,987; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 715 bytes parent folder | download
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
31
32
33
34
35
36
37
use strict;
use warnings;

use Test::More;

BEGIN {
    if (!eval { require Attribute::Types }) {
        plan skip_all => "Attribute::Types required for this test";
        exit();
    }
}

use PPR;

package Foo { }
use Attribute::Types;
use feature qw(state);

my @cases = (
    q{my    Foo $my_count    :INTEGER = 12;},
    q{our   Foo $our_count   :INTEGER = 12;},
    q{state Foo $state_count :INTEGER = 12;},
);
plan tests => 0+@cases;

for my $case (@cases) {
    subtest "Case : << $case >>" => sub {
        ok eval "$case; 1", "valid code" or note "error: $@";
        ok $case =~ m{
            \A (?&PerlEntireDocument) \Z

            $PPR::GRAMMAR
        }x, 'PPR matches';
    };
}

done_testing();