projects
/
gitmo/Moose.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Doc subtype of union bug fix in Changes
[gitmo/Moose.git]
/
t
/
attributes
/
no_init_arg.t
1
#!/usr/bin/perl
2
3
use strict;
4
use warnings;
5
6
use Test::More;
7
8
9
10
{
11
package Foo;
12
use Moose;
13
14
eval {
15
has 'foo' => (
16
is => "rw",
17
init_arg => undef,
18
);
19
};
20
::ok(!$@, '... created the attr okay');
21
}
22
23
{
24
my $foo = Foo->new( foo => "bar" );
25
isa_ok($foo, 'Foo');
26
27
is( $foo->foo, undef, "field is not set via init arg" );
28
29
$foo->foo("blah");
30
31
is( $foo->foo, "blah", "field is set via setter" );
32
}
33
34
done_testing;