File: 100-erroneous-keywords.t

package info (click to toggle)
libmoosex-role-parameterized-perl 1.11-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 464 kB
  • sloc: perl: 439; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 960 bytes parent folder | download | duplicates (4)
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 0.88;
use Test::Fatal;

do {
    package MyRole::Storage;
    use MooseX::Role::Parameterized;

    ::like( ::exception {
        parameter()
    }, qr/^You must provide a name for the attribute/);

    role {
        ::like( ::exception {
            extends 'MyRole::Parameterized';
        }, qr/^Roles do not support 'extends' \(you can use 'with' to specialize a role\)/);
        ::like( ::exception {
            inner()
        }, qr/^Roles cannot support 'inner'/);
        ::like( ::exception {
            augment()
        }, qr/^Roles cannot support 'augment'/);
        ::like( ::exception {
            parameter()
        }, qr/^'parameter' may not be used inside of the role block/);
        ::like( ::exception {
            role {}
        }, qr/^'role' may not be used inside of the role block/);
    };
};

Moose::Meta::Class->create_anon_class(
    roles => ['MyRole::Storage'],
);

done_testing;