X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F014_attribute_introspection.t;h=1ead8530be184aa5948efcb08cf2871b0c298598;hb=77a143bafdd524b01eb35af7d47c2a1d5554b5e2;hp=12f8c94971e94b03580c51a0968fb87a3b1a6d58;hpb=013b1897ada42ebdd970371868cc3679d3a49344;p=gitmo%2FClass-MOP.git diff --git a/t/014_attribute_introspection.t b/t/014_attribute_introspection.t index 12f8c94..1ead853 100644 --- a/t/014_attribute_introspection.t +++ b/t/014_attribute_introspection.t @@ -3,11 +3,11 @@ use strict; use warnings; -use Test::More tests => 39; +use Test::More tests => 60; use Test::Exception; BEGIN { - use_ok('Class::MOP'); + use_ok('Class::MOP'); } { @@ -18,58 +18,81 @@ BEGIN { { my $meta = Class::MOP::Attribute->meta(); isa_ok($meta, 'Class::MOP::Class'); - + my @methods = qw( - meta new clone + + initialize_instance_slot + _set_initial_slot_value + name has_accessor accessor - has_writer writer - has_reader reader + has_writer writer get_write_method get_write_method_ref + has_reader reader get_read_method get_read_method_ref has_predicate predicate + has_clearer clearer + has_builder builder has_init_arg init_arg - has_default default - + has_default default is_default_a_coderef + has_initializer initializer + + slots + get_value + set_value + set_initial_value + has_value + clear_value + associated_class attach_to_class detach_from_class - - generate_accessor_method - generate_reader_method - generate_writer_method - generate_predicate_method - + + accessor_metaclass + + associated_methods + associate_method + process_accessors install_accessors remove_accessors ); - + is_deeply( - [ sort @methods ], [ sort $meta->get_method_list ], - '... our method list matches'); - + [ sort @methods ], + '... our method list matches'); + foreach my $method_name (@methods) { ok($meta->has_method($method_name), '... Class::MOP::Attribute->has_method(' . $method_name . ')'); } - - my @attributes = qw( - name accessor reader writer predicate - init_arg default associated_class - ); + + my @attributes = ( + '$!name', + '$!accessor', + '$!reader', + '$!writer', + '$!predicate', + '$!clearer', + '$!builder', + '$!init_arg', + '$!initializer', + '$!default', + '$!associated_class', + '@!associated_methods', + ); is_deeply( - [ sort @attributes ], [ sort $meta->get_attribute_list ], + [ sort @attributes ], '... our attribute list matches'); - + foreach my $attribute_name (@attributes) { - ok($meta->has_attribute($attribute_name), '... Class::MOP::Attribute->has_attribute(' . $attribute_name . ')'); + ok($meta->has_attribute($attribute_name), '... Class::MOP::Attribute->has_attribute(' . $attribute_name . ')'); } - - # We could add some tests here to make sure that - # the attribute have the appropriate - # accessor/reader/writer/predicate combinations, - # but that is getting a little excessive so I - # wont worry about it for now. Maybe if I get + + # We could add some tests here to make sure that + # the attribute have the appropriate + # accessor/reader/writer/predicate combinations, + # but that is getting a little excessive so I + # wont worry about it for now. Maybe if I get # bored I will do it. -} \ No newline at end of file +}