Created
January 14, 2014 12:23
-
-
Save chrisa/8417484 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Test::More; | |
package Foo; | |
use Moose; | |
use MooseX::UndefTolerant; | |
use MooseX::Types::Moose qw/ Str /; | |
has 'bar' => ( | |
isa => Str, | |
is => 'rw', | |
required => 0, | |
default => 'baz', | |
); | |
__PACKAGE__->meta->make_immutable; | |
1; | |
package main; | |
my $foo = Foo->new( bar => undef ); | |
is ( $foo->bar, 'baz', 'does the default value get set when passing undef in the constructor and make_immutable is set' ); | |
done_testing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment