summaryrefslogtreecommitdiff
path: root/t/exceptions/class-mop-package.t
blob: 4cf78e76512da28995fd5a74eda9ed9a7ac09dd7 (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
35
36
37
38
39
40
41
use strict;
use warnings;

use Test::More;
use Test::Fatal;

use Moose();

{
    my $exception = exception {
        Class::MOP::Package->reinitialize;
    };

    like(
        $exception,
        qr/\QYou must pass a package name or an existing Class::MOP::Package instance/,
        "no package name is given");

    isa_ok(
        $exception,
        "Moose::Exception::MustPassAPackageNameOrAnExistingClassMOPPackageInstance",
        "no package name is given");
}

{
    my $exception = exception {
        Class::MOP::Package->create_anon(cache => 1);
    };

    like(
        $exception,
        qr/Packages are not cacheable/,
        "can't cache anon packages");

    isa_ok(
        $exception,
        "Moose::Exception::PackagesAndModulesAreNotCachable",
        "can't cache anon packages");
}

done_testing;