X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F30-bad.t;fp=t%2F30-bad.t;h=93765cf05a18b5e66e0b79703bdcf53765ad1bb6;hb=8d66aa098b18f8c9724b12bf446d330905122c57;hp=0000000000000000000000000000000000000000;hpb=4c46bbd0856ded38b0cefbabc61dc53b85025d42;p=perl%2Fmodules%2FTest-Valgrind.git diff --git a/t/30-bad.t b/t/30-bad.t new file mode 100644 index 0000000..93765cf --- /dev/null +++ b/t/30-bad.t @@ -0,0 +1,46 @@ +#!perl + +use strict; +use warnings; + +use Config qw/%Config/; + +use Test::More; + +sub tester { + my ($a, $desc) = @_; + my $passed; + my $dbg = eval "Test::Valgrind::DEBUGGING()"; + if ($desc =~ /still\s+reachable/) { + $passed = $a >= 9900 && $a < 10100; + if ($dbg) { + ok($passed, $desc); + } else { + TODO: { + local $TODO = "Leak count may be off on non-debugging perls"; + ok($passed, $desc); + } + return 1; + } + } else { + $passed = defined $a && $a == 0; + is($a, 0, $desc); + } + return $passed; +} + +eval { + require XSLoader; + XSLoader::load('Test::Valgrind', 0.04); +}; +if ($@) { + plan skip_all => "XS test code not available ($@)"; +} else { + use lib qw{blib/archpub}; + eval 'use Test::Valgrind cb => \&tester;'; + if ($@) { + plan skip_all => 'Test::Valgrind is required to run test your distribution with valgrind'; + } else { + Test::Valgrind::leak(); + } +}