move d.pl to a sensible place so the MANIFEST picks it up
[p5sagit/App-FatPacker.git] / t / trace.t
old mode 100644 (file)
new mode 100755 (executable)
index 154e83c..a461001
--- a/t/trace.t
+++ b/t/trace.t
@@ -1,15 +1,16 @@
 #!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"));
 test_trace("t/mod/c.pm" => ());
+test_trace("t/mod/d.pl" => ("t/mod/d.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;
@@ -17,6 +18,23 @@ sub test_trace {
   system($^X, "-Mblib", "-MApp::FatPacker::Trace", $file);
 
   open my $trace, "<", "fatpacker.trace";
+  my @traced = sort map { chomp; $_ } <$trace>;
+
+  is_deeply \@loaded, \@traced, "All expected modules loaded for $file";
+  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 = $_;