Commit | Line | Data |
9fc566e3 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More; |
7 | use Scalar::Util 'blessed'; |
8 | |
9 | do { |
10 | package Foo::Role; |
11 | use Squirrel::Role; |
12 | |
13 | has foo => ( |
14 | isa => "Int", |
15 | is => "rw", |
16 | ); |
17 | |
18 | no Squirrel::Role; |
19 | }; |
20 | |
21 | # note that 'Foo' is defined before this, to prevent Moose being loaded from |
22 | # affecting its definition |
23 | |
24 | BEGIN { |
d1288432 |
25 | plan skip_all => "Moose required for this test" unless eval { require Moose::Role }; |
7bbf018c |
26 | plan tests => 6; |
9fc566e3 |
27 | } |
28 | |
29 | do { |
30 | package Bar::Role; |
31 | use Squirrel::Role; |
32 | |
33 | has foo => ( |
34 | isa => "Int", |
35 | is => "rw", |
36 | ); |
37 | |
38 | no Squirrel::Role; |
39 | }; |
40 | |
41 | ok(!Foo::Role->can('has'), "Mouse::Role::has was unimported"); |
ddd4992c |
42 | SKIP: { |
43 | skip "ancient moose", 1 if $Moose::VERSION <= 0.50; |
44 | ok(!Bar::Role->can('has'), "Moose::Role::has was unimported"); |
45 | } |
9fc566e3 |
46 | |
47 | eval " |
48 | package Foo::Role; |
49 | use Squirrel::Role; |
50 | |
51 | has bar => (is => 'rw'); |
52 | |
53 | package Bar::Role; |
54 | use Squirrel::Role; |
55 | |
56 | has bar => (is => 'rw'); |
57 | "; |
58 | |
d1288432 |
59 | isa_ok(Foo::Role->meta, 'Mouse::Meta::Role'); |
60 | isa_ok(Foo::Role->meta, 'Mouse::Meta::Role'); |
9fc566e3 |
61 | |
d1288432 |
62 | isa_ok(Bar::Role->meta, 'Moose::Meta::Role'); |
63 | isa_ok(Bar::Role->meta, 'Moose::Meta::Role'); |
9fc566e3 |
64 | |