summaryrefslogtreecommitdiff
path: root/t/exceptions/rt-94795.t
blob: 274240741509ec6187ec5a0b234cf6c9644de711 (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;

# https://rt.cpan.org/Ticket/Display.html?id=94795

# the exception produced should be AttributeIsRequired, however
# AttributeIsRequired was throwing the exception ClassNamesDoNotMatch.

{
    package AAA;
    use Moose;
    has my_attr => (
        is => 'ro',
        required => 1,
    );
}

{
    package BBB;
    use Moose;
    extends qw/AAA/;
}

my $e = exception { BBB->new };
ok(
    $e->isa('Moose::Exception::AttributeIsRequired'),
    'got the right exception',
)
or note 'got exception ', ref($e), ': ', $e->message;

done_testing;