File: WillDie.pm

package info (click to toggle)
libtest-unit-perl 0.28-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,312 kB
  • sloc: perl: 4,299; makefile: 5
file content (22 lines) | stat: -rw-r--r-- 426 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package WillDie;

use Error;

use base qw(Test::Unit::TestCase ExceptionChecker);

sub test_dies {
    my $self = shift;
    $self->check_errors(
        'Died' => [ __LINE__, sub { die;        } ],
        'BANG' => [ __LINE__, sub { die "BANG"; } ],
    );
}

sub test_throws_error_simple {
    my $self = shift;
    $self->check_errors(
        'BANG!' => [ __LINE__, sub { Error::Simple->throw("BANG!"); } ],
    );
}

1;