diff options
Diffstat (limited to 't/exceptions/moose-meta-role-application.t')
-rw-r--r-- | t/exceptions/moose-meta-role-application.t | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/t/exceptions/moose-meta-role-application.t b/t/exceptions/moose-meta-role-application.t new file mode 100644 index 0000000..b1ccf62 --- /dev/null +++ b/t/exceptions/moose-meta-role-application.t @@ -0,0 +1,121 @@ +use strict; +use warnings; + +use Test::More; +use Test::Fatal; + +use Moose::Meta::Role::Application; + +{ + my $exception = exception { + Moose::Meta::Role::Application->check_role_exclusions; + }; + + like( + $exception, + qr/Abstract method/, + "cannot call an abstract method"); + + isa_ok( + $exception, + "Moose::Exception::CannotCallAnAbstractMethod", + "cannot call an abstract method"); +} + +{ + my $exception = exception { + Moose::Meta::Role::Application->check_required_methods; + }; + + like( + $exception, + qr/Abstract method/, + "cannot call an abstract method"); + + isa_ok( + $exception, + "Moose::Exception::CannotCallAnAbstractMethod", + "cannot call an abstract method"); +} + +{ + my $exception = exception { + Moose::Meta::Role::Application->check_required_attributes; + }; + + like( + $exception, + qr/Abstract method/, + "cannot call an abstract method"); + + isa_ok( + $exception, + "Moose::Exception::CannotCallAnAbstractMethod", + "cannot call an abstract method"); +} + +{ + my $exception = exception { + Moose::Meta::Role::Application->apply_attributes; + }; + + like( + $exception, + qr/Abstract method/, + "cannot call an abstract method"); + + isa_ok( + $exception, + "Moose::Exception::CannotCallAnAbstractMethod", + "cannot call an abstract method"); +} + +{ + my $exception = exception { + Moose::Meta::Role::Application->apply_methods; + }; + + like( + $exception, + qr/Abstract method/, + "cannot call an abstract method"); + + isa_ok( + $exception, + "Moose::Exception::CannotCallAnAbstractMethod", + "cannot call an abstract method"); +} + +{ + my $exception = exception { + Moose::Meta::Role::Application->apply_override_method_modifiers; + }; + + like( + $exception, + qr/Abstract method/, + "cannot call an abstract method"); + + isa_ok( + $exception, + "Moose::Exception::CannotCallAnAbstractMethod", + "cannot call an abstract method"); +} + +{ + my $exception = exception { + Moose::Meta::Role::Application->apply_method_modifiers; + }; + + like( + $exception, + qr/Abstract method/, + "cannot call an abstract method"); + + isa_ok( + $exception, + "Moose::Exception::CannotCallAnAbstractMethod", + "cannot call an abstract method"); +} + +done_testing; |