X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F073_make_mutable.t;h=0fec326041599a20dba9b7ea55d84907e065b166;hb=3d2695646c17fca63e20186eeda494323b6aca02;hp=1c2998182da036a3ac68b3af7308b305f16c9b7e;hpb=46b23b447c9ab2e7681b7377d505f2ad6fbc39b3;p=gitmo%2FClass-MOP.git diff --git a/t/073_make_mutable.t b/t/073_make_mutable.t index 1c29981..0fec326 100644 --- a/t/073_make_mutable.t +++ b/t/073_make_mutable.t @@ -45,7 +45,7 @@ BEGIN { { my $meta = Baz->meta; is($meta->name, 'Baz', '... checking the Baz metaclass'); - my @orig_keys = sort keys %$meta; + my @orig_keys = sort grep { !/^_/ } keys %$meta; lives_ok {$meta->make_immutable; } '... changed Baz to be immutable'; ok(!$meta->is_mutable, '... our class is no longer mutable'); @@ -61,7 +61,7 @@ BEGIN { ok(!$meta->get_method_map->{new}, '... inlined constructor removed'); ok(!$meta->has_method('new'), '... inlined constructor removed for sure'); - my @new_keys = sort keys %$meta; + my @new_keys = sort grep { !/^_/ } keys %$meta; is_deeply(\@orig_keys, \@new_keys, '... no straneous hashkeys'); isa_ok($meta, 'Class::MOP::Class', '... Baz->meta isa Class::MOP::Class'); @@ -71,10 +71,10 @@ BEGIN { ok(! $meta->has_method('zxy') ,'... we dont have the aliased method yet'); ok( $meta->alias_method('zxy',sub{'xxx'}),'... aliased method'); - ok(! $meta->has_method('zxy') ,'... the aliased method does not register (correctly)'); + ok( $meta->has_method('zxy') ,'... the aliased method does register'); is( Baz->zxy, 'xxx', '... method zxy works'); ok( $meta->remove_method('xyz'), '... removed method'); - ok(! $meta->remove_method('zxy'), '... removed aliased method'); + ok( $meta->remove_method('zxy'), '... removed aliased method'); ok($meta->add_attribute('fickle', accessor => 'fickle'), '... added attribute'); ok(Baz->can('fickle'), '... Baz can fickle'); @@ -132,7 +132,7 @@ BEGIN { ok(Baz->meta->is_immutable, 'Superclass is immutable'); my $meta = Baz->meta->create_anon_class(superclasses => ['Baz']); - my @orig_keys = sort keys %$meta; + my @orig_keys = sort grep { !/^_/ } keys %$meta; my @orig_meths = sort { $a->{name} cmp $b->{name} } $meta->compute_all_applicable_methods; ok($meta->is_anon_class, 'We have an anon metaclass'); @@ -156,7 +156,7 @@ BEGIN { ok($meta->is_anon_class, '... still marked as an anon class'); my $instance = $meta->new_object; - my @new_keys = sort keys %$meta; + my @new_keys = sort grep { !/^_/ } keys %$meta; my @new_meths = sort { $a->{name} cmp $b->{name} } $meta->compute_all_applicable_methods; is_deeply(\@orig_keys, \@new_keys, '... no straneous hashkeys'); @@ -169,7 +169,7 @@ BEGIN { ok( $meta->alias_method('zxy',sub{'xxx'}),'... aliased method'); is( $instance->zxy, 'xxx', '... method zxy works'); ok( $meta->remove_method('xyz'), '... removed method'); - ok( !$meta->remove_method('zxy'), '... removed aliased method'); + ok( $meta->remove_method('zxy'), '... removed aliased method'); ok($meta->add_attribute('fickle', accessor => 'fickle'), '... added attribute'); ok($instance->can('fickle'), '... instance can fickle');