Commit | Line | Data |
692e1bcd |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More; |
7 | |
8 | { |
9 | package Foo; |
10 | use Squirrel; |
11 | |
12 | has foo => ( |
13 | isa => "Int", |
14 | is => "rw", |
15 | ); |
16 | } |
17 | |
18 | # note that 'Foo' is defined before this, to prevent Moose being loaded from |
19 | # affecting its definition |
20 | |
21 | BEGIN { |
22 | plan skip_all => "Moose required for this test" unless eval { require Moose }; |
23 | plan 'no_plan'; |
24 | } |
25 | |
26 | { |
27 | package Bar; |
28 | use Squirrel; |
29 | |
30 | has foo => ( |
31 | isa => "Int", |
32 | is => "rw", |
33 | ); |
34 | } |
35 | |
36 | my $foo = Foo->new( foo => 3 ); |
37 | |
38 | isa_ok( $foo, "Foo" ); |
39 | |
40 | isa_ok( $foo, "Mouse::Object" ); |
41 | |
42 | is( $foo->foo, 3, "accessor" ); |
43 | |
44 | |
45 | my $bar = Bar->new( foo => 3 ); |
46 | |
47 | isa_ok( $bar, "Bar" ); |
48 | isa_ok( $bar, "Moose::Object" ); |
49 | |
50 | is( $bar->foo, 3, "accessor" ); |