From: Vincent Pit Date: Fri, 30 Oct 2015 15:30:20 +0000 (-0200) Subject: Enable the 'diag' option in tests X-Git-Tag: v1.15~4 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=0c5d8f138c37804f0587deba3db2a1ce8ee674b2;p=perl%2Fmodules%2FTest-Valgrind.git Enable the 'diag' option in tests This will make it easier to debug test failures (like if the child dies). --- diff --git a/t/10-good.t b/t/10-good.t index 3552113..0d56967 100644 --- a/t/10-good.t +++ b/t/10-good.t @@ -9,7 +9,7 @@ use lib 't/lib'; eval { require Test::Valgrind; - Test::Valgrind->import; + Test::Valgrind->import(diag => 1); }; if ($@) { diag $@; @@ -24,4 +24,4 @@ if ($@) { } plan tests => 1; -fail 'should not be seen'; +fail 'dummy test in the child, should not interfere with the actual TAP stream'; diff --git a/t/20-bad.t b/t/20-bad.t index 490b779..f36e2f5 100644 --- a/t/20-bad.t +++ b/t/20-bad.t @@ -9,7 +9,9 @@ use lib 't/lib'; eval { require Test::Valgrind; - Test::Valgrind->import(action => 'Test::Valgrind::Test::Action'); + Test::Valgrind->import( + action => 'Test::Valgrind::Test::Action', + ); }; if ($@) { diag $@; @@ -24,5 +26,6 @@ eval { if ($@) { diag $@; } else { + diag "leaking some bytes!"; Test::Valgrind::leak(); } diff --git a/t/lib/Test/Valgrind/Test/Action.pm b/t/lib/Test/Valgrind/Test/Action.pm index c56eb03..07ffde5 100644 --- a/t/lib/Test/Valgrind/Test/Action.pm +++ b/t/lib/Test/Valgrind/Test/Action.pm @@ -23,7 +23,14 @@ BEGIN { use Test::Builder; -sub new { shift->SUPER::new(extra_tests => $extra_tests) } +sub new { + my $class = shift; + + $class->SUPER::new( + diag => 1, + extra_tests => $extra_tests, + ); +} my @filtered_reports;