diff options
Diffstat (limited to 't/exceptions/metaclass.t')
-rw-r--r-- | t/exceptions/metaclass.t | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/t/exceptions/metaclass.t b/t/exceptions/metaclass.t new file mode 100644 index 0000000..5492df1 --- /dev/null +++ b/t/exceptions/metaclass.t @@ -0,0 +1,34 @@ +use strict; +use warnings; + +use Test::More; +use Test::Fatal; + +{ + { + package Foo; + use Moose; + } + + my $exception = exception { + require metaclass; + metaclass->import( ("Foo") ); + }; + + like( + $exception, + qr/\QThe metaclass (Foo) must be derived from Class::MOP::Class/, + "Foo is not derived from Class::MOP::Class"); + + isa_ok( + $exception, + "Moose::Exception::MetaclassMustBeDerivedFromClassMOPClass", + "Foo is not derived from Class::MOP::Class"); + + is( + $exception->class_name, + 'Foo', + "Foo is not derived from Class::MOP::Class"); +} + +done_testing; |