use strict;
use warnings;
-use Test::More tests => 30;
+use Test::More tests => 33;
use Test::Exception;
BEGIN {
isa_ok($meta, 'Class::MOP::Class');
is_deeply(
- [ sort { $a->{name} cmp $b->{name} } $meta->compute_all_applicable_attributes() ],
+ [ sort { $a->name cmp $b->name } $meta->compute_all_applicable_attributes() ],
[
- {
- name => '$bar',
- class => 'Bar',
- attribute => $BAR_ATTR
- },
- {
- name => '$baz',
- class => 'Baz',
- attribute => $BAZ_ATTR
- },
- {
- name => '$foo',
- class => 'Foo',
- attribute => $FOO_ATTR
- },
+ $BAR_ATTR,
+ $BAZ_ATTR,
+ $FOO_ATTR,
],
'... got the right list of applicable attributes for Baz');
+
+ is_deeply(
+ [ map { $_->associated_class } sort { $a->name cmp $b->name } $meta->compute_all_applicable_attributes() ],
+ [ Bar->meta, Baz->meta, Foo->meta ],
+ '... got the right list of associated classes from the applicable attributes for Baz');
my $attr;
lives_ok {
ok(!$meta->has_method('set_baz'), '... a writer has been removed');
is_deeply(
- [ sort { $a->{name} cmp $b->{name} } $meta->compute_all_applicable_attributes() ],
+ [ sort { $a->name cmp $b->name } $meta->compute_all_applicable_attributes() ],
[
- {
- name => '$bar',
- class => 'Bar',
- attribute => $BAR_ATTR
- },
- {
- name => '$foo',
- class => 'Foo',
- attribute => $FOO_ATTR
- },
+ $BAR_ATTR,
+ $FOO_ATTR,
],
'... got the right list of applicable attributes for Baz');
+ is_deeply(
+ [ map { $_->associated_class } sort { $a->name cmp $b->name } $meta->compute_all_applicable_attributes() ],
+ [ Bar->meta, Foo->meta ],
+ '... got the right list of associated classes from the applicable attributes for Baz');
+
{
my $attr;
lives_ok {
}
is_deeply(
- [ sort { $a->{name} cmp $b->{name} } $meta->compute_all_applicable_attributes() ],
+ [ sort { $a->name cmp $b->name } $meta->compute_all_applicable_attributes() ],
[
- {
- name => '$foo',
- class => 'Foo',
- attribute => $FOO_ATTR
- },
+ $FOO_ATTR,
],
'... got the right list of applicable attributes for Baz');
+ is_deeply(
+ [ map { $_->associated_class } sort { $a->name cmp $b->name } $meta->compute_all_applicable_attributes() ],
+ [ Foo->meta ],
+ '... got the right list of associated classes from the applicable attributes for Baz');
+
}