X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F014_attribute_introspection.t;h=57819e0ac070bacf47fcb19a761882d27348eea7;hb=5e5102f19ccb1dc52b290577b0363e97dacbd5b3;hp=16cf78fa14794b580c825cded93dec7bdcf4eb1d;hpb=89871ad6548566c183b41a36cc4e62e9b72fb5a0;p=gitmo%2FClass-MOP.git diff --git a/t/014_attribute_introspection.t b/t/014_attribute_introspection.t index 16cf78f..57819e0 100644 --- a/t/014_attribute_introspection.t +++ b/t/014_attribute_introspection.t @@ -1,23 +1,20 @@ -#!/usr/bin/perl - use strict; use warnings; -use Test::More tests => 62; -use Test::Exception; +use Test::More; +use Test::Fatal; -BEGIN { - use_ok('Class::MOP'); -} +use Class::MOP; { my $attr = Class::MOP::Attribute->new('$test'); - is($attr->meta, Class::MOP::Attribute->meta, '... instance and class both lead to the same meta'); + is( $attr->meta, Class::MOP::Attribute->meta, + '... instance and class both lead to the same meta' ); } { my $meta = Class::MOP::Attribute->meta(); - isa_ok($meta, 'Class::MOP::Class'); + isa_ok( $meta, 'Class::MOP::Class' ); my @methods = qw( new @@ -38,10 +35,15 @@ BEGIN { has_init_arg init_arg has_default default is_default_a_coderef has_initializer initializer + has_insertion_order insertion_order _set_insertion_order + + definition_context slots get_value set_value + get_raw_value + set_raw_value set_initial_value has_value clear_value @@ -56,41 +58,67 @@ BEGIN { associate_method process_accessors + _process_accessors install_accessors remove_accessors - ); + + _inline_get_value + _inline_set_value + _inline_has_value + _inline_clear_value + _inline_instance_get + _inline_instance_set + _inline_instance_has + _inline_instance_clear + + _new + ); is_deeply( - [ sort $meta->get_method_list ], + [ + sort Class::MOP::Mixin::AttributeCore->meta->get_method_list, + $meta->get_method_list + ], [ sort @methods ], - '... our method list matches'); + '... our method list matches' + ); foreach my $method_name (@methods) { - ok($meta->has_method($method_name), '... Class::MOP::Attribute->has_method(' . $method_name . ')'); + ok( $meta->find_method_by_name($method_name), + '... Class::MOP::Attribute->find_method_by_name(' . $method_name . ')' ); } my @attributes = ( - '$!name', - '$!accessor', - '$!reader', - '$!writer', - '$!predicate', - '$!clearer', - '$!builder', - '$!init_arg', - '$!initializer', - '$!default', - '$!associated_class', - '@!associated_methods', + 'name', + 'accessor', + 'reader', + 'writer', + 'predicate', + 'clearer', + 'builder', + 'init_arg', + 'initializer', + 'definition_context', + 'default', + 'associated_class', + 'associated_methods', + 'insertion_order', ); is_deeply( - [ sort $meta->get_attribute_list ], + [ + sort Class::MOP::Mixin::AttributeCore->meta->get_attribute_list, + $meta->get_attribute_list + ], [ sort @attributes ], - '... our attribute list matches'); + '... our attribute list matches' + ); foreach my $attribute_name (@attributes) { - ok($meta->has_attribute($attribute_name), '... Class::MOP::Attribute->has_attribute(' . $attribute_name . ')'); + ok( $meta->find_attribute_by_name($attribute_name), + '... Class::MOP::Attribute->find_attribute_by_name(' + . $attribute_name + . ')' ); } # We could add some tests here to make sure that @@ -100,3 +128,5 @@ BEGIN { # wont worry about it for now. Maybe if I get # bored I will do it. } + +done_testing;