use lib 't/lib', 'lib';
-use Test::More tests => 5;
+use Test::More tests => 4;
+use Test::Exception;
{
+
package Bar;
use Moose;
- eval { extends 'Foo'; };
- ::ok(!$@, '... loaded Foo superclass correctly');
+ ::lives_ok { extends 'Foo' } 'loaded Foo superclass correctly';
}
{
+
package Baz;
use Moose;
- eval { extends 'Bar'; };
- ::ok(!$@, '... loaded (inline) Bar superclass correctly');
+ ::lives_ok { extends 'Bar' } 'loaded (inline) Bar superclass correctly';
}
{
+
package Foo::Bar;
use Moose;
- eval { extends 'Foo', 'Bar'; };
- ::ok(!$@, '... loaded Foo and (inline) Bar superclass correctly');
+ ::lives_ok { extends 'Foo', 'Bar' }
+ 'loaded Foo and (inline) Bar superclass correctly';
}
{
+
package Bling;
use Moose;
- eval { extends 'No::Class'; };
- my $e = $@;
- ::ok($e, '... could not find the superclass (as expected)');
- ::like($e, qr{Can't locate No/Class\.pm in \@INC}, '... and got the error we expected');
+ ::throws_ok { extends 'No::Class' }
+ qr{Can't locate No/Class\.pm in \@INC},
+ 'correct error when superclass could not be found';
}