X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fimport_into.t;h=066e1722fb05197fbeeb67ff5fe4a6fdb2ddb84a;hb=bd74adea007ab33d9b1321d911dd76371317c128;hp=4fcf9cad7028f1714d554ee91c1248235daa4d85;hpb=568eef3eaba8968cd37b29f669648c302bf7ac60;p=p5sagit%2FImport-Into.git diff --git a/t/import_into.t b/t/import_into.t index 4fcf9ca..066e172 100644 --- a/t/import_into.t +++ b/t/import_into.t @@ -12,6 +12,8 @@ BEGIN { sub thing { 'thing' } + $INC{"MyExporter.pm"} = 1; + package MultiExporter; use Import::Into; @@ -43,25 +45,26 @@ BEGIN { $INC{"CheckFile.pm"} = 1; } -BEGIN { +eval q{ package TestPackage; - no warnings; + no warnings FATAL => 'all'; -#line 1 +#line 1 "import_into_inline.pl" use MultiExporter; sub test { thing . undef } -} + 1; +} or die $@; my @w; is(do { local $SIG{__WARN__} = sub { push @w, @_; }; - TestPackage::test; + TestPackage::test(); }, 'thing', 'returned thing ok'); is(scalar @w, 1, 'Only one entry in @w'); @@ -69,7 +72,7 @@ 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[1], 'import_into_inline.pl', 'import by level has correct file'; is $checkcaller[2], 1, 'import by level has correct line'; CheckFile->import::into({ @@ -83,3 +86,7 @@ is $checkcaller[0], 'ExplicitPackage', 'import with hash has correct package'; is $checkcaller[1], 'explicit-file.pl', 'import with hash has correct file'; is $checkcaller[2], 42, 'import with hash has correct line'; is $checkversion, 219, 'import with hash has correct version'; + +ok( !IPC::Open3->can("open3"), "IPC::Open3 is unloaded" ); +IPC::Open3->import::into("TestPackage"); +ok( TestPackage->can("open3"), "IPC::Open3 was use'd and import::into'd" );