Convert all tests to done_testing.
[gitmo/Moose.git] / t / 050_metaclasses / 010_extending_and_embedding_back_compat.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Exception;
8
9
10 BEGIN {
11     package MyFramework::Base;
12     use Moose;
13
14     package MyFramework::Meta::Base;
15     use Moose;
16
17     extends 'Moose::Meta::Class';
18
19     package MyFramework;
20     use Moose;
21
22     sub import {
23         my $CALLER = caller();
24
25         strict->import;
26         warnings->import;
27
28         return if $CALLER eq 'main';
29         Moose::init_meta( $CALLER, 'MyFramework::Base', 'MyFramework::Meta::Base' );
30         Moose->import({ into => $CALLER });
31
32         return 1;
33     }
34 }
35
36 {
37     package MyClass;
38     BEGIN { MyFramework->import }
39
40     has 'foo' => (is => 'rw');
41 }
42
43 can_ok( 'MyClass', 'meta' );
44
45 isa_ok(MyClass->meta, 'MyFramework::Meta::Base');
46 isa_ok(MyClass->meta, 'Moose::Meta::Class');
47
48 my $obj = MyClass->new(foo => 10);
49 isa_ok($obj, 'MyClass');
50 isa_ok($obj, 'MyFramework::Base');
51 isa_ok($obj, 'Moose::Object');
52
53 is($obj->foo, 10, '... got the right value');
54
55 done_testing;