Commit | Line | Data |
7a50b450 |
1 | #!/usr/bin/env perl |
fde8e43f |
2 | # This is automatically generated by author/import-moose-test.pl. |
3 | # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! |
4 | use t::lib::MooseCompat; |
7a50b450 |
5 | use strict; |
6 | use warnings; |
fde8e43f |
7 | use Test::More; |
8 | use Mouse (); |
7a50b450 |
9 | |
10 | my $role = Mouse::Meta::Role->create( |
11 | 'MyItem::Role::Equipment', |
12 | attributes => { |
13 | is_worn => { |
14 | is => 'rw', |
15 | isa => 'Bool', |
16 | }, |
17 | }, |
18 | methods => { |
19 | remove => sub { shift->is_worn(0) }, |
20 | }, |
21 | ); |
22 | |
23 | my $class = Mouse::Meta::Class->create('MyItem::Armor::Helmet' => |
24 | roles => ['MyItem::Role::Equipment'], |
25 | ); |
26 | |
27 | my $visored = $class->new_object(is_worn => 0); |
28 | ok(!$visored->is_worn, "attribute, accessor was consumed"); |
29 | $visored->is_worn(1); |
30 | ok($visored->is_worn, "accessor was consumed"); |
31 | $visored->remove; |
32 | ok(!$visored->is_worn, "method was consumed"); |
33 | |
34 | ok(!$role->is_anon_role, "the role is not anonymous"); |
35 | |
fde8e43f |
36 | done_testing; |