Commit | Line | Data |
4060c871 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More tests => 4; |
7 | use Test::Exception; |
8 | |
9 | |
10 | |
11 | { |
12 | package Foo; |
13 | use Mouse; |
14 | |
15 | eval { |
16 | has 'foo' => ( |
17 | is => "rw", |
18 | init_arg => undef, |
19 | ); |
20 | }; |
21 | ::ok(!$@, '... created the attr okay'); |
22 | } |
23 | |
24 | { |
25 | my $foo = Foo->new( foo => "bar" ); |
26 | isa_ok($foo, 'Foo'); |
27 | |
28 | is( $foo->foo, undef, "field is not set via init arg" ); |
29 | |
30 | $foo->foo("blah"); |
31 | |
32 | is( $foo->foo, "blah", "field is set via setter" ); |
33 | } |