Move Archive::Tar from ext/ to cpan/
[p5sagit/p5-mst-13.2.git] / ext / autodie / t / crickey.t
1 #!/usr/bin/perl -w
2 use strict;
3 use FindBin;
4 use Test::More 'no_plan';
5
6 use lib "$FindBin::Bin/lib";
7
8 use constant NO_SUCH_FILE => "crickey_mate_this_file_isnt_here_either";
9
10 use autodie::test::au qw(open);
11
12 eval {
13     open(my $fh, '<', NO_SUCH_FILE);
14 };
15
16 ok(my $e = $@, 'Strewth!  autodie::test::au should throw an exception on failure');
17
18 isa_ok($e, 'autodie::test::au::exception',
19     'Yeah mate, that should be our test exception.');
20
21 like($e, qr/time for a beer/, "Time for a beer mate?");
22
23 like( eval { $e->time_for_a_beer; },
24     qr/time for a beer/, "It's always a good time for a beer."
25 );
26
27 ok($e->matches('open'), "Should be a fair dinkum error from open");