Update some doc
[gitmo/Mouse.git] / t / 202-squirrel-role.t
CommitLineData
9fc566e3 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More;
7use Scalar::Util 'blessed';
8
9do {
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
24BEGIN {
d1288432 25 plan skip_all => "Moose required for this test" unless eval { require Moose::Role };
7bbf018c 26 plan tests => 6;
9fc566e3 27}
28
29do {
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
41ok(!Foo::Role->can('has'), "Mouse::Role::has was unimported");
ddd4992c 42SKIP: {
43 skip "ancient moose", 1 if $Moose::VERSION <= 0.50;
44 ok(!Bar::Role->can('has'), "Moose::Role::has was unimported");
45}
9fc566e3 46
47eval "
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 59isa_ok(Foo::Role->meta, 'Mouse::Meta::Role');
60isa_ok(Foo::Role->meta, 'Mouse::Meta::Role');
9fc566e3 61
d1288432 62isa_ok(Bar::Role->meta, 'Moose::Meta::Role');
63isa_ok(Bar::Role->meta, 'Moose::Meta::Role');
9fc566e3 64