From: Tatsuhiko Miyagawa Date: Fri, 17 Apr 2015 15:38:41 +0000 (+0200) Subject: add test for virtual inc entry exclusion X-Git-Tag: v0.010003~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=73bca3c94bbb58e0902b693fcdec6b4494f1eb51;p=p5sagit%2FApp-FatPacker.git add test for virtual inc entry exclusion --- diff --git a/t/d.pl b/t/d.pl new file mode 100644 index 0000000..7217002 --- /dev/null +++ b/t/d.pl @@ -0,0 +1 @@ +use t::mod::d; diff --git a/t/mod/d.pm b/t/mod/d.pm new file mode 100644 index 0000000..53ddfc1 --- /dev/null +++ b/t/mod/d.pm @@ -0,0 +1,4 @@ +package t::mod::d; +$INC{"t/mod/foreign.pm"} = __FILE__; +1; + diff --git a/t/pack.t b/t/pack.t old mode 100644 new mode 100755 index c88b9e1..6924f69 --- a/t/pack.t +++ b/t/pack.t @@ -54,6 +54,7 @@ require $temp_fh; 't/mod/b.pm', 't/mod/c.pm', 't/mod/cond.pm', + 't/mod/d.pm', ], "\$INC[0]->files returned the files" ); } diff --git a/t/trace.t b/t/trace.t old mode 100644 new mode 100755 index ab3a490..63338a5 --- a/t/trace.t +++ b/t/trace.t @@ -6,6 +6,7 @@ use Test::More qw(no_plan); test_trace("t/mod/a.pm" => ("t/mod/b.pm", "t/mod/c.pm")); test_trace("t/mod/b.pm" => ("t/mod/c.pm")); test_trace("t/mod/c.pm" => ()); +test_trace("t/d.pl" => ("t/mod/d.pm")); # Attempts to conditionally load a module that isn't present test_trace("t/mod/cond.pm" => ()); @@ -17,13 +18,9 @@ sub test_trace { system($^X, "-Mblib", "-MApp::FatPacker::Trace", $file); open my $trace, "<", "fatpacker.trace"; - while(<$trace>) { - chomp; - my $load = $_; - @loaded = grep { $load ne $_ } @loaded; - } + my @traced = sort map { chomp; $_ } <$trace>; - ok !@loaded, "All expected modules loaded for $file"; + is_deeply \@loaded, \@traced, "All expected modules loaded for $file"; unlink "fatpacker.trace"; }