From: Shawn M Moore Date: Fri, 10 Jul 2009 06:15:49 +0000 (-0400) Subject: Make sure is => undef works X-Git-Tag: 0.01~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7c1b021e1d52ec36082ce430f1692bd8e2c1370e;p=gitmo%2FMooseX-HasDefaults.git Make sure is => undef works --- diff --git a/t/003-no-accessor.t b/t/003-no-accessor.t new file mode 100644 index 0000000..c1b8a2f --- /dev/null +++ b/t/003-no-accessor.t @@ -0,0 +1,29 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 5; +use Test::Exception; + +do { + package Person; + use Moose; + use MooseX::IsDefaults::RO; + + has name => ( + isa => 'Str', + ); + + has blah => ( + is => undef, + predicate => 'has_blah', + ); +}; + +can_ok(Person => qw(name)); +ok(!Person->can('blah')); + +my $person = Person->new(name => 'Joe', blah => 'secret'); +is($person->name, 'Joe'); +is($person->{blah}, 'secret', 'an attribute was created even though it has no accessor'); +ok($person->has_blah); +