Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / t / 020_attributes / 018_no_init_arg.t
1 #!/usr/bin/perl
2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
5
6 use strict;
7 use warnings;
8
9 use Test::More;
10 use Test::Exception;
11
12
13
14 {
15     package Foo;
16     use Mouse;
17
18     eval {
19         has 'foo' => (
20             is => "rw",
21             init_arg => undef,
22         );
23     };
24     ::ok(!$@, '... created the attr okay');
25 }
26
27 {
28     my $foo = Foo->new( foo => "bar" );
29     isa_ok($foo, 'Foo');
30
31     is( $foo->foo, undef, "field is not set via init arg" );
32
33     $foo->foo("blah");
34
35     is( $foo->foo, "blah", "field is set via setter" );
36 }
37
38 done_testing;