• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package Test::ANTLR::Runtime::Exception;
2
3use Test::More;
4
5use Moose;
6
7BEGIN { extends 'My::Test::Class' }
8
9sub constructor : Test(1) {
10    my ($self) = @_;
11    my $ex = $self->class->new();
12    is $ex->message, '';
13}
14
15sub constructor_message : Test(1) {
16    my ($self) = @_;
17    my $ex = $self->class->new({ message => 'test error message' });
18    is $ex->message, 'test error message';
19}
20
21sub throw : Test(1) {
22    my ($self) = @_;
23    eval {
24        $self->class->throw(message => 'test error message');
25    };
26    my $ex = $self->class->caught();
27    is $ex->message, 'test error message';
28}
29
30no Moose;
31__PACKAGE__->meta->make_immutable(inline_constructor => 0);
321;
33