Commit | Line | Data |
---|---|---|
779ca481 | 1 | #!/usr/bin/perl |
2 | ||
3 | use Test::More; | |
4 | ||
5 | package Foo; | |
6 | ||
7 | use Moose; | |
8 | use MooseX::UndefTolerant::Attribute; | |
9 | ||
10 | has bar => ( | |
11 | is => 'rw', | |
12 | traits => ['MooseX::UndefTolerant::Attribute'], | |
13 | default => 'baz' | |
14 | ); | |
15 | ||
16 | 1; | |
17 | ||
18 | package main; | |
19 | ||
20 | my $foo = Foo->new( bar => undef ); | |
21 | is ( $foo->bar, 'baz', 'does the default value get set when passing undef in the constructor' ); | |
22 | ||
23 | done_testing; |