Commit | Line | Data |
7c1b021e |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
4 | use Test::More tests => 5; |
5 | use Test::Exception; |
6 | |
7 | do { |
8 | package Person; |
9 | use Moose; |
e24f444c |
10 | use MooseX::HasDefaults::RO; |
7c1b021e |
11 | |
12 | has name => ( |
13 | isa => 'Str', |
14 | ); |
15 | |
16 | has blah => ( |
17 | is => undef, |
18 | predicate => 'has_blah', |
19 | ); |
20 | }; |
21 | |
22 | can_ok(Person => qw(name)); |
23 | ok(!Person->can('blah')); |
24 | |
25 | my $person = Person->new(name => 'Joe', blah => 'secret'); |
26 | is($person->name, 'Joe'); |
27 | is($person->{blah}, 'secret', 'an attribute was created even though it has no accessor'); |
28 | ok($person->has_blah); |
29 | |