Debian lenny version packages
[pkg-perl] / deb-src / libtest-exception-perl / libtest-exception-perl-0.27 / t / preserve.t
1 #! /usr/bin/perl -Tw
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 5;
7
8 BEGIN { use_ok( 'Test::Exception' ) };
9
10 sub div {
11    my ($a, $b) = @_;
12    return( $a / $b );
13 };
14
15 dies_ok { div(1, 0) } 'exception thrown okay in dies_ok';
16 like( $@, '/^Illegal division by zero/', 'exception preserved after dies_ok' );
17
18 throws_ok { div(1, 0) } '/^Illegal division by zero/', 'exception thrown okay in throws_ok';
19 like( $@, '/^Illegal division by zero/', 'exception preserved after thrown_ok' );