complete re-organization of the test suite
[gitmo/Moose.git] / t / 010_basics / 002_require_superclasses.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use lib 't/lib', 'lib';
7
8 use Test::More tests => 6;
9
10 BEGIN {
11     use_ok('Moose');           
12 }
13
14 {
15     package Bar;
16     use Moose;
17     
18     eval { extends 'Foo'; };
19     ::ok(!$@, '... loaded Foo superclass correctly');
20 }
21
22 {
23     package Baz;
24     use Moose;
25     
26     eval { extends 'Bar'; };
27     ::ok(!$@, '... loaded (inline) Bar superclass correctly');
28 }
29
30 {
31     package Foo::Bar;
32     use Moose;
33     
34     eval { extends 'Foo', 'Bar'; };
35     ::ok(!$@, '... loaded Foo and (inline) Bar superclass correctly');
36 }
37
38 {
39     package Bling;
40     use Moose;
41     
42     eval { extends 'No::Class'; };
43     ::ok($@, '... could not find the superclass (as expected)');
44     ::like($@, qr/^Could not load class \(No\:\:Class\) because \:/, '... and got the error we expected');
45 }
46