4 use Test::More tests => 42;
8 use_ok('Class::MOP::Package');
9 use_ok('Class::MOP::Module');
10 use_ok('Class::MOP::Class');
11 use_ok('Class::MOP::Immutable');
12 use_ok('Class::MOP::Attribute');
13 use_ok('Class::MOP::Method');
14 use_ok('Class::MOP::Method::Wrapped');
15 use_ok('Class::MOP::Method::Generated');
16 use_ok('Class::MOP::Method::Accessor');
17 use_ok('Class::MOP::Method::Constructor');
18 use_ok('Class::MOP::Instance');
19 use_ok('Class::MOP::Object');
22 # make sure we are tracking metaclasses correctly
24 my @CLASS_MOP_CLASS_IMMUTABLE_CLASSES
25 = map { 'Class::MOP::Class::__ANON__::SERIAL::' . $_ } 1..11;
28 'Class::MOP::Attribute' => Class::MOP::Attribute->meta,
29 'Class::MOP::Method::Generated' => Class::MOP::Method::Generated->meta,
30 'Class::MOP::Method::Accessor' => Class::MOP::Method::Accessor->meta,
31 'Class::MOP::Method::Constructor' =>
32 Class::MOP::Method::Constructor->meta,
33 'Class::MOP::Package' => Class::MOP::Package->meta,
34 'Class::MOP::Module' => Class::MOP::Module->meta,
35 'Class::MOP::Class' => Class::MOP::Class->meta,
36 'Class::MOP::Method' => Class::MOP::Method->meta,
37 'Class::MOP::Method::Wrapped' => Class::MOP::Method::Wrapped->meta,
38 'Class::MOP::Instance' => Class::MOP::Instance->meta,
39 'Class::MOP::Object' => Class::MOP::Object->meta,
42 ok( Class::MOP::is_class_loaded($_), '... ' . $_ . ' is loaded' )
45 ok( $_->is_immutable(), '... ' . $_->name . ' is immutable' )
49 {Class::MOP::get_all_metaclasses},
52 map { $_ => $_->meta } @CLASS_MOP_CLASS_IMMUTABLE_CLASSES
54 '... got all the metaclasses'
59 sort { $a->name cmp $b->name } Class::MOP::get_all_metaclass_instances
62 Class::MOP::Attribute->meta,
63 Class::MOP::Class->meta,
64 ( map { $_->meta } sort @CLASS_MOP_CLASS_IMMUTABLE_CLASSES ),
65 Class::MOP::Instance->meta,
66 Class::MOP::Method->meta,
67 Class::MOP::Method::Accessor->meta,
68 Class::MOP::Method::Constructor->meta,
69 Class::MOP::Method::Generated->meta,
70 Class::MOP::Method::Wrapped->meta,
71 Class::MOP::Module->meta,
72 Class::MOP::Object->meta,
73 Class::MOP::Package->meta,
75 '... got all the metaclass instances'
79 [ sort { $a cmp $b } Class::MOP::get_all_metaclass_names() ],
86 Class::MOP::Method::Accessor
87 Class::MOP::Method::Constructor
88 Class::MOP::Method::Generated
89 Class::MOP::Method::Wrapped
93 /, @CLASS_MOP_CLASS_IMMUTABLE_CLASSES
95 '... got all the metaclass names'
100 map { $_->meta->identifier }
101 sort { $a cmp $b } Class::MOP::get_all_metaclass_names()
104 "Class::MOP::Attribute-"
105 . $Class::MOP::Attribute::VERSION
107 "Class::MOP::Class-" . $Class::MOP::Class::VERSION . "-cpan:STEVAN",
108 ( sort @CLASS_MOP_CLASS_IMMUTABLE_CLASSES ),
109 "Class::MOP::Instance-"
110 . $Class::MOP::Instance::VERSION
112 "Class::MOP::Method-" . $Class::MOP::Method::VERSION . "-cpan:STEVAN",
113 "Class::MOP::Method::Accessor-"
114 . $Class::MOP::Method::Accessor::VERSION
116 "Class::MOP::Method::Constructor-"
117 . $Class::MOP::Method::Constructor::VERSION
119 "Class::MOP::Method::Generated-"
120 . $Class::MOP::Method::Generated::VERSION
122 "Class::MOP::Method::Wrapped-"
123 . $Class::MOP::Method::Wrapped::VERSION
125 "Class::MOP::Module-" . $Class::MOP::Module::VERSION . "-cpan:STEVAN",
126 "Class::MOP::Object-" . $Class::MOP::Object::VERSION . "-cpan:STEVAN",
127 "Class::MOP::Package-"
128 . $Class::MOP::Package::VERSION
131 '... got all the metaclass identifiers'
134 # testing the meta-circularity of the system
137 Class::MOP::Class->meta, Class::MOP::Class->meta->meta,
138 '... Class::MOP::Class->meta == Class::MOP::Class->meta->meta'
142 Class::MOP::Class->meta, Class::MOP::Class->meta->meta->meta,
143 '... Class::MOP::Class->meta == Class::MOP::Class->meta->meta->meta'
147 Class::MOP::Class->meta, Class::MOP::Class->meta->meta->meta->meta,
148 '... Class::MOP::Class->meta == Class::MOP::Class->meta->meta->meta->meta'