Commit | Line | Data |
94b8bbb8 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More tests => 7; |
7 | use Test::Exception; |
8 | |
9 | BEGIN { |
10 | use_ok('Moose'); |
11 | } |
12 | |
13 | ## Roles |
14 | |
15 | { |
16 | package Test::TheDefaultFor::ArrayRef::and::HashRef; |
17 | use Moose; |
18 | |
19 | has 'array_ref' => (is => 'rw', isa => 'ArrayRef'); |
20 | has 'hash_ref' => (is => 'rw', isa => 'HashRef'); |
21 | |
22 | } |
23 | |
24 | my $test = Test::TheDefaultFor::ArrayRef::and::HashRef->new; |
25 | isa_ok($test, 'Test::TheDefaultFor::ArrayRef::and::HashRef'); |
26 | |
27 | is_deeply($test->array_ref, [], '.... got the right default value'); |
28 | is_deeply($test->hash_ref, {}, '.... got the right default value'); |
29 | |
30 | my $test2 = Test::TheDefaultFor::ArrayRef::and::HashRef->new( |
31 | array_ref => [ 1, 2, [] ], |
32 | hash_ref => { one => 1, two => 2, three => {} }, |
33 | ); |
34 | isa_ok($test2, 'Test::TheDefaultFor::ArrayRef::and::HashRef'); |
35 | |
36 | is_deeply($test2->array_ref, [ 1, 2, [] ], '.... got the right default value'); |
37 | is_deeply($test2->hash_ref, { one => 1, two => 2, three => {} }, '.... got the right default value'); |