This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update the Change log in Module::CoreList to include recent commits
[perl5.git] / cpan / autodie / t / crickey.t
CommitLineData
0b09a93a
PF
1#!/usr/bin/perl -w
2use strict;
3use FindBin;
4use Test::More 'no_plan';
5
6use lib "$FindBin::Bin/lib";
7
8use constant NO_SUCH_FILE => "crickey_mate_this_file_isnt_here_either";
9
10use autodie::test::au qw(open);
11
12eval {
13 open(my $fh, '<', NO_SUCH_FILE);
14};
15
16ok(my $e = $@, 'Strewth! autodie::test::au should throw an exception on failure');
17
18isa_ok($e, 'autodie::test::au::exception',
19 'Yeah mate, that should be our test exception.');
20
21like($e, qr/time for a beer/, "Time for a beer mate?");
22
23like( eval { $e->time_for_a_beer; },
24 qr/time for a beer/, "It's always a good time for a beer."
25);
26
27ok($e->matches('open'), "Should be a fair dinkum error from open");