1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use Moose();
{
my $exception = exception {
Class::MOP::Method::Generated->new;
};
like(
$exception,
qr/\QClass::MOP::Method::Generated is an abstract base class, you must provide a constructor./,
"trying to call an abstract base class constructor");
isa_ok(
$exception,
"Moose::Exception::CannotCallAnAbstractBaseMethod",
"trying to call an abstract base class constructor");
}
{
my $exception = exception {
Class::MOP::Method::Generated->_initialize_body;
};
like(
$exception,
qr/\QNo body to initialize, Class::MOP::Method::Generated is an abstract base class/,
"trying to call a method of an abstract class");
isa_ok(
$exception,
"Moose::Exception::NoBodyToInitializeInAnAbstractBaseClass",
"trying to call a method of an abstract class");
}
done_testing;
|