Commit | Line | Data |
---|---|---|
d7f17ebb | 1 | #!/usr/bin/perl |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | use lib 't/lib', 'lib'; | |
7 | ||
a28e50e4 | 8 | use Test::More; |
53a4d826 | 9 | use Test::Exception; |
7ff56534 | 10 | |
d7f17ebb | 11 | |
d7f17ebb | 12 | { |
6b584f6c | 13 | |
d7f17ebb | 14 | package Bar; |
d7f17ebb | 15 | use Moose; |
d03bd989 | 16 | |
53a4d826 | 17 | ::lives_ok { extends 'Foo' } 'loaded Foo superclass correctly'; |
d7f17ebb | 18 | } |
19 | ||
20 | { | |
6b584f6c | 21 | |
d7f17ebb | 22 | package Baz; |
d7f17ebb | 23 | use Moose; |
d03bd989 | 24 | |
53a4d826 | 25 | ::lives_ok { extends 'Bar' } 'loaded (inline) Bar superclass correctly'; |
d7f17ebb | 26 | } |
27 | ||
28 | { | |
6b584f6c | 29 | |
d7f17ebb | 30 | package Foo::Bar; |
d7f17ebb | 31 | use Moose; |
d03bd989 | 32 | |
53a4d826 | 33 | ::lives_ok { extends 'Foo', 'Bar' } |
6b584f6c | 34 | 'loaded Foo and (inline) Bar superclass correctly'; |
d7f17ebb | 35 | } |
36 | ||
7eaef7ad | 37 | { |
6b584f6c | 38 | |
7eaef7ad | 39 | package Bling; |
7eaef7ad | 40 | use Moose; |
d03bd989 | 41 | |
53a4d826 | 42 | ::throws_ok { extends 'No::Class' } |
6b584f6c | 43 | qr{Can't locate No/Class\.pm in \@INC}, |
44 | 'correct error when superclass could not be found'; | |
7eaef7ad | 45 | } |
46 | ||
2e7f6cf4 | 47 | { |
48 | package Affe; | |
49 | our $VERSION = 23; | |
50 | } | |
51 | ||
52 | { | |
53 | package Tiger; | |
54 | use Moose; | |
55 | ||
53a4d826 | 56 | ::lives_ok { extends 'Foo', Affe => { -version => 13 } } |
2e7f6cf4 | 57 | 'extends with version requirement'; |
58 | } | |
59 | ||
60 | { | |
61 | package Birne; | |
62 | use Moose; | |
63 | ||
53a4d826 | 64 | ::throws_ok { extends 'Foo', Affe => { -version => 42 } } |
2e7f6cf4 | 65 | qr/Affe version 42 required--this is only version 23/, |
66 | 'extends with unsatisfied version requirement'; | |
67 | } | |
68 | ||
a28e50e4 | 69 | done_testing; |