-#!perl
use strict;
use warnings FATAL => 'all';
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/mod/ModuleA.pm" => ("ModuleB.pm", "ModuleC.pm"));
+test_trace("t/mod/ModuleB.pm" => ("ModuleC.pm"));
+test_trace("t/mod/ModuleC.pm" => ());
+test_trace("t/mod/ModuleD.pl" => ("ModuleD.pm"));
# Attempts to conditionally load a module that isn't present
-test_trace("t/mod/cond.pm" => ());
+test_trace("t/mod/ModuleCond.pm" => ());
sub test_trace {
my($file, @loaded) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
- system($^X, "-Mblib", "-MApp::FatPacker::Trace", $file);
+ unlink "fatpacker.trace";
+ system($^X, "-Mblib", '-It/mod', "-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>;
+ close $trace;
- ok !@loaded, "All expected modules loaded for $file";
+ is_deeply \@traced, \@loaded, "All expected modules loaded for $file";
unlink "fatpacker.trace";
}
-