From: Chris Andrews Date: Fri, 8 Oct 2010 15:24:52 +0000 (+0100) Subject: Failing test showing that UndefTolerant fails with immutable classes. X-Git-Tag: 0.06~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-UndefTolerant.git;a=commitdiff_plain;h=46e1f0a3e264950534b11b0c46933e034909f95e Failing test showing that UndefTolerant fails with immutable classes. --- diff --git a/t/immutable.t b/t/immutable.t new file mode 100644 index 0000000..6a15655 --- /dev/null +++ b/t/immutable.t @@ -0,0 +1,33 @@ +use Test::More; + +package Foo; +use Moose; +use MooseX::UndefTolerant; + +has 'bar' => ( + is => 'ro', + isa => 'Num', + predicate => 'has_bar' +); + +__PACKAGE__->meta->make_immutable; + +package main; + +{ + my $foo = Foo->new; + ok(!$foo->has_bar); +} + +{ + my $foo = Foo->new(bar => undef); + ok(!$foo->has_bar); +} + +{ + my $foo = Foo->new(bar => 1234); + cmp_ok($foo->bar, 'eq', 1234); + ok($foo->has_bar); +} + +done_testing;