From: Graham Knop Date: Sat, 7 Sep 2013 21:30:14 +0000 (-0400) Subject: test import by level X-Git-Tag: v1.002000~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FImport-Into.git;a=commitdiff_plain;h=e5f9555dcd1499015a2ab8fa2623fca86d526405;hp=3946b3211d4c1adef2221543abd60c8f80088b99 test import by level --- diff --git a/t/import_into.t b/t/import_into.t index bc323fb..6bb30ad 100644 --- a/t/import_into.t +++ b/t/import_into.t @@ -20,17 +20,31 @@ BEGIN { my $target = caller; warnings->import::into($target); MyExporter->import::into($target, 'thing'); + CheckFile->import::into(1); } $INC{"MultiExporter.pm"} = 1; } +my @checkcaller; +BEGIN { + + package CheckFile; + + sub import { + @checkcaller = caller; + } + + $INC{"CheckFile.pm"} = 1; +} + BEGIN { package TestPackage; no warnings; +#line 1 use MultiExporter; sub test { @@ -48,3 +62,7 @@ is(do { is(scalar @w, 1, 'Only one entry in @w'); like($w[0], qr/uninitialized/, 'Correct warning'); + +is $checkcaller[0], 'TestPackage', 'import by level has correct package'; +is $checkcaller[1], __FILE__, 'import by level has correct file'; +is $checkcaller[2], 1, 'import by level has correct line';