Resolve a todo
[gitmo/Mouse.git] / t / 020_attributes / 018_no_init_arg.t
CommitLineData
4060c871 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 4;
7use 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}