X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F003-no-accessor.t;fp=t%2F003-no-accessor.t;h=c1b8a2f12403669f254f3e6487647d13046fbeec;hb=7c1b021e1d52ec36082ce430f1692bd8e2c1370e;hp=0000000000000000000000000000000000000000;hpb=b74f6a249040c0bd4715884ae4b3545dffe0d04d;p=gitmo%2FMooseX-IsDefaults.git 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); +