diff options
Diffstat (limited to 't/exceptions/class-mop-method-generated.t')
-rw-r--r-- | t/exceptions/class-mop-method-generated.t | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/t/exceptions/class-mop-method-generated.t b/t/exceptions/class-mop-method-generated.t new file mode 100644 index 0000000..59a91b6 --- /dev/null +++ b/t/exceptions/class-mop-method-generated.t @@ -0,0 +1,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; |