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