From: Graham Knop Date: Mon, 23 Dec 2013 15:28:41 +0000 (-0500) Subject: clean up sub in INC test to hopefully avoid errors X-Git-Tag: v2.000_001~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4a3702fdcebb0db61d208043acf44102c31a1d54;p=p5sagit%2Flocal-lib.git clean up sub in INC test to hopefully avoid errors --- diff --git a/t/subroutine-in-inc.t b/t/subroutine-in-inc.t index 6d0480f..733bb86 100644 --- a/t/subroutine-in-inc.t +++ b/t/subroutine-in-inc.t @@ -5,24 +5,20 @@ use Test::More tests => 1; use File::Spec; use Cwd; -use File::Temp qw/ tempdir /; -my $base; +use lib 't/lib'; use TempDir; +use local::lib (); sub CODE_in_INC() { return scalar grep { ref eq 'CODE' } @INC; } -my $dir; +my $dir = mk_temp_dir('sub-in-INC-XXXXX'); -BEGIN { - $base = CODE_in_INC; - unshift @INC, sub { () }; - splice @INC, 3, 1, sub { () }; - push @INC, sub { () }; +my $base = CODE_in_INC; +unshift @INC, sub { () }; +splice @INC, 3, 1, sub { () }; +push @INC, sub { () }; - $dir = tempdir( DIR => Cwd::abs_path('t'), CLEANUP => 1 ); -} - -use local::lib( $dir ); +local::lib->import($dir); is( CODE_in_INC, $base + 3 );