X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Ftrace.t;h=ab3a490b0a495f4422a1c0be23b4988de3dcaf22;hb=3c29415b9a630f4d6ac50c43c450736c86a61436;hp=154e83c3257c59537eb8cb2be80b22c936f66639;hpb=dc7a3a086bb4da8332ab8c8b07716698e565c7a7;p=p5sagit%2FApp-FatPacker.git diff --git a/t/trace.t b/t/trace.t index 154e83c..ab3a490 100644 --- a/t/trace.t +++ b/t/trace.t @@ -1,5 +1,7 @@ #!perl -use Test::More; +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")); @@ -8,8 +10,6 @@ test_trace("t/mod/c.pm" => ()); # Attempts to conditionally load a module that isn't present test_trace("t/mod/cond.pm" => ()); -done_testing; - sub test_trace { my($file, @loaded) = @_; local $Test::Builder::Level = $Test::Builder::Level + 1; @@ -27,3 +27,24 @@ sub test_trace { unlink "fatpacker.trace"; } +test_trace("t/mod/a.pm" => ("t/mod/b.pm", "t/mod/c.pm")); + +sub test_trace_stderr { + my($file, @loaded) = @_; + local $Test::Builder::Level = $Test::Builder::Level + 1; + + system(join(' ', + $^X, "-Mblib", "-MApp::FatPacker::Trace", '--to-stderr', $file, + '>', 'fatpacker.trace', '2>&1')); + + open my $trace, "<", "fatpacker.trace"; + while(<$trace>) { + chomp; + my $load = $_; + @loaded = grep { $load ne $_ } @loaded; + } + + ok !@loaded, "All expected modules loaded for $file"; + unlink "fatpacker.trace"; +} +