Modified source files and compiled any and armel versions of packages
[pkg-perl] / deb-src / libtest-exception-perl / libtest-exception-perl-0.27 / t / lives_and.t
1 #! /usr/bin/perl -Tw
2
3 use strict;
4 use warnings;
5 use Test::Builder::Tester tests => 3;
6 use Test::More;
7
8 BEGIN { use_ok( 'Test::Exception' ) };
9
10 sub works {return shift};
11 sub dies { die 'oops' };
12
13 my $filename = sub { return (caller)[1] }->();
14
15 lives_and {is works(42), 42} 'lives_and, no_exception & success';
16
17 test_out('not ok 1 - lives_and, no_exception & failure');
18 test_fail(+3);
19 test_err("#          got: '42'");
20 test_err("#     expected: '24'");
21 lives_and {is works(42), 24}    'lives_and, no_exception & failure';
22          
23 test_out('not ok 2 - lives_and, exception');
24 test_fail(+2);
25 test_err("# died: oops at $filename line 11.");
26 lives_and {is dies(42), 42}             'lives_and, exception';
27
28 test_out('ok 3 - The object isa Foo' );
29 lives_and { isa_ok( bless({}, 'Foo'), 'Foo') };
30
31 test_test('lives_and works');