From: Diab Jerius Date: Sun, 17 Nov 2013 02:25:44 +0000 (-0500) Subject: add tests for object @INC hook X-Git-Tag: v0.010000~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5a64a6aacbcd03b85afba691e0fd279eeed3422d;p=p5sagit%2FApp-FatPacker.git add tests for object @INC hook --- diff --git a/t/pack.t b/t/pack.t index d3fcba3..cbbcb71 100644 --- a/t/pack.t +++ b/t/pack.t @@ -42,11 +42,32 @@ require $temp_fh; ok $t::mod::a::foo eq 'bar', "packed script works"; } +{ + + ok ref $INC[0], "\$INC[0] is a reference"; + ok $INC[0]->can( "files" ), "\$INC[0] has a files method"; + + my @files = sort $INC[0]->files; + + is_deeply( \@files, [ 't/mod/a.pm', + 't/mod/b.pm', + 't/mod/c.pm', + 't/mod/cond.pm', + ], "\$INC[0]->files returned the files" ); + +} + + if (my $testwith = $ENV{'FATPACKER_TESTWITH'}) { for my $perl (split ' ', $testwith) { my $out = system $perl, '-e', q{alarm 5; require $ARGV[0]; require t::mod::a; exit($t::mod::a::foo eq 'bar' ? 0 : 1)}, $temp_fh; ok !$out, "packed script works with $perl"; + + $out = system $perl, '-e', + q{alarm 5; require $ARGV[0]; exit( (sort $INC[0]->files)[0] eq 't/mod/a.pm' ? 0 : 1 )}, $temp_fh; + ok !$out, "\$INC[0]->files works with $perl"; + } }