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; |
6475f69d |
7 | use Test::More; |
fde8e43f |
8 | $TODO = q{Mouse is not yet completed}; |
6475f69d |
9 | use Mouse (); |
7a50b450 |
10 | |
11 | my $role = Mouse::Meta::Role->create_anon_role( |
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 | $role->apply($class); |
25 | # XXX: Mouse::Util::apply_all_roles doesn't cope with references yet |
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 | |
fde8e43f |
34 | like($role->name, qr/^Mouse::Meta::Role::__ANON__::SERIAL::\d+$/, ""); |
7a50b450 |
35 | ok($role->is_anon_role, "the role knows it's anonymous"); |
36 | |
37 | ok(Mouse::Util::is_class_loaded(Mouse::Meta::Role->create_anon_role->name), "creating an anonymous role satisifes is_class_loaded"); |
6475f69d |
38 | ok(Mouse::Util::class_of(Mouse::Meta::Role->create_anon_role->name), "creating an anonymous role satisifes class_of"); |
7a50b450 |
39 | |
6475f69d |
40 | done_testing; |