Home | History | Annotate | Download | only in Runtime
      1 package Test::ANTLR::Runtime::Exception;
      2 
      3 use Test::More;
      4 
      5 use Moose;
      6 
      7 BEGIN { extends 'My::Test::Class' }
      8 
      9 sub constructor : Test(1) {
     10     my ($self) = @_;
     11     my $ex = $self->class->new();
     12     is $ex->message, '';
     13 }
     14 
     15 sub 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 
     21 sub 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 
     30 no Moose;
     31 __PACKAGE__->meta->make_immutable(inline_constructor => 0);
     32 1;
     33