4 use Test::More tests => 23;
13 our $VERSION = '0.01';
18 our $AUTHORITY = 'cpan:JRANDOM';
22 isa_ok($Foo, 'Class::MOP::Class');
25 isa_ok($Bar, 'Class::MOP::Class');
27 is($Foo->name, 'Foo', '... Foo->name == Foo');
28 is($Bar->name, 'Bar', '... Bar->name == Bar');
30 is($Foo->version, '0.01', '... Foo->version == 0.01');
31 is($Bar->version, undef, '... Bar->version == undef');
33 is($Foo->authority, undef, '... Foo->authority == undef');
34 is($Bar->authority, 'cpan:JRANDOM', '... Bar->authority == cpan:JRANDOM');
36 is($Foo->identifier, 'Foo-0.01', '... Foo->identifier == Foo-0.01');
37 is($Bar->identifier, 'Bar-cpan:JRANDOM', '... Bar->identifier == Bar-cpan:JRANDOM');
39 is_deeply([$Foo->superclasses], [], '... Foo has no superclasses');
40 is_deeply([$Bar->superclasses], ['Foo'], '... Bar->superclasses == (Foo)');
42 $Foo->superclasses('UNIVERSAL');
44 is_deeply([$Foo->superclasses], ['UNIVERSAL'], '... Foo->superclasses == (UNIVERSAL) now');
47 [ $Foo->class_precedence_list ],
48 [ 'Foo', 'UNIVERSAL' ],
49 '... Foo->class_precedence_list == (Foo, UNIVERSAL)');
52 [ $Bar->class_precedence_list ],
53 [ 'Bar', 'Foo', 'UNIVERSAL' ],
54 '... Bar->class_precedence_list == (Bar, Foo, UNIVERSAL)');
56 # create a class using Class::MOP::Class ...
58 my $Baz = Class::MOP::Class->create(
61 authority => 'cpan:YOMAMA',
62 superclasses => [ 'Bar' ]
64 isa_ok($Baz, 'Class::MOP::Class');
65 is(Baz->meta, $Baz, '... our metaclasses are singletons');
67 is($Baz->name, 'Baz', '... Baz->name == Baz');
68 is($Baz->version, '0.10', '... Baz->version == 0.10');
69 is($Baz->authority, 'cpan:YOMAMA', '... Baz->authority == YOMAMA');
71 is($Baz->identifier, 'Baz-0.10-cpan:YOMAMA', '... Baz->identifier == Baz-0.10-cpan:YOMAMA');
73 is_deeply([$Baz->superclasses], ['Bar'], '... Baz->superclasses == (Bar)');
76 [ $Baz->class_precedence_list ],
77 [ 'Baz', 'Bar', 'Foo', 'UNIVERSAL' ],
78 '... Baz->class_precedence_list == (Baz, Bar, Foo, UNIVERSAL)');