got rid of all the use_ok junk except for 000_load.t
[gitmo/Class-MOP.git] / t / 103_Perl6Attribute_test.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 9;
7 use File::Spec;
8
9 BEGIN {use Class::MOP;    
10     require_ok(File::Spec->catfile('examples', 'Perl6Attribute.pod'));
11 }
12
13 {
14     package Foo;
15     
16     use metaclass;
17     
18     Foo->meta->add_attribute(Perl6Attribute->new('$.foo'));
19     Foo->meta->add_attribute(Perl6Attribute->new('@.bar'));    
20     Foo->meta->add_attribute(Perl6Attribute->new('%.baz'));    
21     
22     sub new  {
23         my $class = shift;
24         $class->meta->new_object(@_);
25     }      
26 }
27
28 my $foo = Foo->new();
29 isa_ok($foo, 'Foo');
30
31 can_ok($foo, 'foo');
32 can_ok($foo, 'bar');
33 can_ok($foo, 'baz');
34
35 is($foo->foo, undef, '... Foo.foo == undef');
36
37 $foo->foo(42);
38 is($foo->foo, 42, '... Foo.foo == 42');
39
40 is_deeply($foo->bar, [], '... Foo.bar == []');
41 is_deeply($foo->baz, {}, '... Foo.baz == {}');