1#!/usr/bin/perl -w
2use strict;
3use warnings;
4use autodie;
5use Test::More 'no_plan';
6use FindBin qw($Bin);
7use lib "$Bin/lib";
8use Caller_helper;
9
10use constant NO_SUCH_FILE => "kiwifoo_is_so_much_fun";
11
12eval {
13    foo();
14};
15
16isa_ok($@, 'autodie::exception');
17
18is($@->caller, 'main::foo', "Caller should be main::foo");
19
20sub foo {
21    use autodie;
22    open(my $fh, '<', NO_SUCH_FILE);
23}
24
25eval {
26    Caller_helper::foo();
27};
28
29isa_ok($@, 'autodie::exception');
30
31is($@->line,     $Caller_helper::line,     "External line number check");
32is($@->file,     $INC{"Caller_helper.pm"}, "External filename check");
33is($@->package, "Caller_helper",           "External package check");
34is($@->caller,  "Caller_helper::foo",      "External subname check");
35