summaryrefslogtreecommitdiff
path: root/t/exceptions/metaclass.t
blob: 5492df1c29c427a98cc280a465b04c75ffa75eda (plain)
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
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;