-#!/usr/bin/perl
-
use strict;
use warnings;
-use Test::More tests => 232;
+use Test::More tests => 294;
use Test::Exception;
use Class::MOP;
my @class_mop_module_methods = qw(
_new
- version authority identifier
+ _instantiate_module
+
+ version authority identifier create
);
my @class_mop_class_methods = qw(
create_anon_class is_anon_class
- instance_metaclass get_meta_instance create_meta_instance
+ instance_metaclass get_meta_instance
+ create_meta_instance _create_meta_instance
new_object clone_object
- construct_instance construct_class_instance clone_instance
- rebless_instance
- check_metaclass_compatibility
- check_metaclass_compatability
+ construct_instance _construct_instance
+ construct_class_instance _construct_class_instance
+ clone_instance _clone_instance
+ rebless_instance rebless_instance_away
+ check_metaclass_compatibility _check_metaclass_compatibility
- add_meta_instance_dependencies remove_meta_instance_depdendencies update_meta_instance_dependencies
+ add_meta_instance_dependencies remove_meta_instance_dependencies update_meta_instance_dependencies
add_dependent_meta_instance remove_dependent_meta_instance
invalidate_meta_instances invalidate_meta_instance
- attribute_metaclass method_metaclass
+ attribute_metaclass method_metaclass wrapped_method_metaclass
superclasses subclasses class_precedence_list linearized_isa
has_method get_method add_method remove_method alias_method wrap_method_body
- get_method_list get_method_map get_all_methods compute_all_applicable_methods
+ get_method_list get_method_map get_all_method_names get_all_methods compute_all_applicable_methods
find_method_by_name find_all_methods_by_name find_next_method_by_name
add_before_method_modifier add_after_method_modifier add_around_method_modifier
has_attribute get_attribute add_attribute remove_attribute
get_attribute_list get_attribute_map get_all_attributes compute_all_applicable_attributes find_attribute_by_name
- is_mutable is_immutable make_mutable make_immutable create_immutable_transformer
- get_immutable_options get_immutable_transformer
+ is_mutable is_immutable make_mutable make_immutable
+ _initialize_immutable _install_inlined_code _inlined_methods
+ _add_inlined_method _inline_accessors _inline_constructor
+ _inline_destructor _immutable_options _rebless_as_immutable
+ _rebless_as_mutable _remove_inlined_code
+
+ immutable_metaclass immutable_trait constructor_name constructor_class destructor_class
+
+ immutable_transformer
DESTROY
);
# check the class ...
-is_deeply([ sort @class_mop_class_methods ], [ sort $class_mop_class_meta->get_method_list ], '... got the correct method list for class');
+is_deeply([ sort $class_mop_class_meta->get_method_list ], [ sort @class_mop_class_methods ], '... got the correct method list for class');
-foreach my $method_name (@class_mop_class_methods) {
+foreach my $method_name (sort @class_mop_class_methods) {
ok($class_mop_class_meta->has_method($method_name), '... Class::MOP::Class->has_method(' . $method_name . ')');
{
no strict 'refs';
## check the package ....
-is_deeply([ sort @class_mop_package_methods ], [ sort $class_mop_package_meta->get_method_list ], '... got the correct method list for package');
+is_deeply([ sort $class_mop_package_meta->get_method_list ], [ sort @class_mop_package_methods ], '... got the correct method list for package');
-foreach my $method_name (@class_mop_package_methods) {
+foreach my $method_name (sort @class_mop_package_methods) {
ok($class_mop_package_meta->has_method($method_name), '... Class::MOP::Package->has_method(' . $method_name . ')');
{
no strict 'refs';
## check the module ....
-is_deeply([ sort @class_mop_module_methods ], [ sort $class_mop_module_meta->get_method_list ], '... got the correct method list for module');
+is_deeply([ sort $class_mop_module_meta->get_method_list ], [ sort @class_mop_module_methods ], '... got the correct method list for module');
-foreach my $method_name (@class_mop_module_methods) {
+foreach my $method_name (sort @class_mop_module_methods) {
ok($class_mop_module_meta->has_method($method_name), '... Class::MOP::Module->has_method(' . $method_name . ')');
{
no strict 'refs';
'attributes',
'attribute_metaclass',
'method_metaclass',
- 'instance_metaclass'
+ 'wrapped_method_metaclass',
+ 'instance_metaclass',
+ 'immutable_trait',
+ 'constructor_name',
+ 'constructor_class',
+ 'destructor_class',
);
# check class
is_deeply(
- [ sort @class_mop_class_attributes ],
[ sort $class_mop_class_meta->get_attribute_list ],
- '... got the right list of attributes');
+ [ sort @class_mop_class_attributes ],
+ '... got the right list of attributes'
+);
is_deeply(
- [ sort @class_mop_class_attributes ],
[ sort keys %{$class_mop_class_meta->get_attribute_map} ],
+ [ sort @class_mop_class_attributes ],
'... got the right list of attributes');
-foreach my $attribute_name (@class_mop_class_attributes) {
+foreach my $attribute_name (sort @class_mop_class_attributes) {
ok($class_mop_class_meta->has_attribute($attribute_name), '... Class::MOP::Class->has_attribute(' . $attribute_name . ')');
isa_ok($class_mop_class_meta->get_attribute($attribute_name), 'Class::MOP::Attribute');
}
# check module
is_deeply(
- [ sort @class_mop_package_attributes ],
[ sort $class_mop_package_meta->get_attribute_list ],
+ [ sort @class_mop_package_attributes ],
'... got the right list of attributes');
is_deeply(
- [ sort @class_mop_package_attributes ],
[ sort keys %{$class_mop_package_meta->get_attribute_map} ],
+ [ sort @class_mop_package_attributes ],
'... got the right list of attributes');
-foreach my $attribute_name (@class_mop_package_attributes) {
+foreach my $attribute_name (sort @class_mop_package_attributes) {
ok($class_mop_package_meta->has_attribute($attribute_name), '... Class::MOP::Package->has_attribute(' . $attribute_name . ')');
isa_ok($class_mop_package_meta->get_attribute($attribute_name), 'Class::MOP::Attribute');
}
# check package
is_deeply(
- [ sort @class_mop_module_attributes ],
[ sort $class_mop_module_meta->get_attribute_list ],
+ [ sort @class_mop_module_attributes ],
'... got the right list of attributes');
is_deeply(
- [ sort @class_mop_module_attributes ],
[ sort keys %{$class_mop_module_meta->get_attribute_map} ],
+ [ sort @class_mop_module_attributes ],
'... got the right list of attributes');
-foreach my $attribute_name (@class_mop_module_attributes) {
+foreach my $attribute_name (sort @class_mop_module_attributes) {
ok($class_mop_module_meta->has_attribute($attribute_name), '... Class::MOP::Module->has_attribute(' . $attribute_name . ')');
isa_ok($class_mop_module_meta->get_attribute($attribute_name), 'Class::MOP::Attribute');
}
'Class::MOP::Method',
'... Class::MOP::Class method_metaclass\'s a default is Class::MOP:::Method');
+ok($class_mop_class_meta->get_attribute('wrapped_method_metaclass')->has_reader, '... Class::MOP::Class wrapped_method_metaclass has a reader');
+is_deeply($class_mop_class_meta->get_attribute('wrapped_method_metaclass')->reader,
+ { 'wrapped_method_metaclass' => \&Class::MOP::Class::wrapped_method_metaclass },
+ '... Class::MOP::Class wrapped_method_metaclass\'s a reader is &wrapped_method_metaclass');
+
+ok($class_mop_class_meta->get_attribute('wrapped_method_metaclass')->has_init_arg, '... Class::MOP::Class wrapped_method_metaclass has a init_arg');
+is($class_mop_class_meta->get_attribute('wrapped_method_metaclass')->init_arg,
+ 'wrapped_method_metaclass',
+ '... Class::MOP::Class wrapped_method_metaclass\'s init_arg is wrapped_method_metaclass');
+
+ok($class_mop_class_meta->get_attribute('method_metaclass')->has_default, '... Class::MOP::Class method_metaclass has a default');
+is($class_mop_class_meta->get_attribute('method_metaclass')->default,
+ 'Class::MOP::Method',
+ '... Class::MOP::Class method_metaclass\'s a default is Class::MOP:::Method');
+
# check the values of some of the methods
is($class_mop_class_meta->name, 'Class::MOP::Class', '... Class::MOP::Class->name');