diff options
Diffstat (limited to 't/exceptions/rt-92818.t')
-rw-r--r-- | t/exceptions/rt-92818.t | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/t/exceptions/rt-92818.t b/t/exceptions/rt-92818.t new file mode 100644 index 0000000..b504841 --- /dev/null +++ b/t/exceptions/rt-92818.t @@ -0,0 +1,45 @@ +use strict; +use warnings; + +use Test::More; +use Test::Fatal; + +# https://rt.cpan.org/Ticket/Display.html?id=92818 + +{ + package Parent; + use Moose; + has x => ( + is => 'rw', + required => 1, + ); +} + +{ + my $e = exception { my $obj = Parent->new }; + ok( + $e->isa('Moose::Exception::AttributeIsRequired'), + 'got the right exception', + ) + or note 'got exception ', ref($e), ': ', $e->message; +} + +{ + package Child; + use Moose; + extends 'Parent'; +} + +# the exception produced should be AttributeIsRequired, however +# AttributeIsRequired was throwing the exception ClassNamesDoNotMatch. + +{ + my $e = exception { my $obj = Child->new }; + ok( + $e->isa('Moose::Exception::AttributeIsRequired'), + 'got the right exception', + ) + or note 'got exception ', ref($e), ': ', $e->message; +} + +done_testing; |