simplify more stuff
[gitmo/Class-MOP.git] / t / 025_attribute_non_alpha_name.t
CommitLineData
55743c1a 1use strict;
2use warnings;
3
4use Class::MOP;
5
6use Test::More;
7
8{
9 package Foo;
10 use metaclass;
11
12 Foo->meta->add_attribute( '@foo', accessor => 'foo' );
13 Foo->meta->add_attribute( '!bar', reader => 'bar' );
14 Foo->meta->add_attribute( '%baz', reader => 'baz' );
15}
16
17{
18 my $meta = Foo->meta;
19
20 for my $name ( '@foo', '!bar', '%baz' ) {
21 ok(
22 $meta->has_attribute($name),
23 "Foo has $name attribute"
24 );
25
26 my $meth = substr $name, 1;
27 ok( $meta->has_method($meth), 'Foo has $meth method' );
28 }
29
30 $meta->make_immutable, redo
31 unless $meta->is_immutable;
32}
33
34done_testing;