diff options
Diffstat (limited to 'cpan/autodie/t/caller.t')
-rwxr-xr-x | cpan/autodie/t/caller.t | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/cpan/autodie/t/caller.t b/cpan/autodie/t/caller.t new file mode 100755 index 0000000000..1874353627 --- /dev/null +++ b/cpan/autodie/t/caller.t @@ -0,0 +1,34 @@ +#!/usr/bin/perl -w +use strict; +use warnings; +use autodie; +use Test::More 'no_plan'; +use FindBin qw($Bin); +use lib "$Bin/lib"; +use Caller_helper; + +use constant NO_SUCH_FILE => "kiwifoo_is_so_much_fun"; + +eval { + foo(); +}; + +isa_ok($@, 'autodie::exception'); + +is($@->caller, 'main::foo', "Caller should be main::foo"); + +sub foo { + use autodie; + open(my $fh, '<', NO_SUCH_FILE); +} + +eval { + Caller_helper::foo(); +}; + +isa_ok($@, 'autodie::exception'); + +is($@->line, $Caller_helper::line, "External line number check"); +is($@->file, $INC{"Caller_helper.pm"}, "External filename check"); +is($@->package, "Caller_helper", "External package check"); +is($@->caller, "Caller_helper::foo", "External subname check"); |