From: Vincent Pit Date: Sat, 27 Sep 2008 22:20:49 +0000 (+0200) Subject: Port to use Test::Builder internally X-Git-Tag: v0.07~17 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Valgrind.git;a=commitdiff_plain;h=987e9c3448c1fc1668b162e3d25c39f6593ba000 Port to use Test::Builder internally --- diff --git a/Makefile.PL b/Makefile.PL index 1ac7172..cb1e729 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -110,7 +110,7 @@ WriteMakefile( 'Exporter' => 0, 'POSIX' => 0, 'Perl::Destruct::Level' => 0, - 'Test::More' => 0, + 'Test::Builder' => 0, }, dist => { PREOP => "touch lib/$supp; " diff --git a/lib/Test/Valgrind.pm b/lib/Test/Valgrind.pm index 34ff5d9..a656130 100644 --- a/lib/Test/Valgrind.pm +++ b/lib/Test/Valgrind.pm @@ -5,7 +5,7 @@ use warnings; use Carp qw/croak/; use POSIX qw/SIGTERM/; -use Test::More; +use Test::Builder; use Perl::Destruct::Level level => 3; @@ -98,6 +98,8 @@ Specifies a subroutine to execute for each test instead of C. It =cut +my $Test = Test::Builder->new; + my $run; sub _counter { @@ -105,7 +107,7 @@ sub _counter { } sub _tester { - is($_[0], 0, $_[1]); + $Test->is_num($_[0], 0, $_[1]); _counter(@_); } @@ -144,7 +146,7 @@ sub import { } } if (!$vg) { - plan skip_all => 'No valgrind executable could be found in your path'; + $Test->plan(skip_all => 'No valgrind executable could be found in your path'); return; } } @@ -181,17 +183,17 @@ sub import { } close $wtr or croak "close(\$wtr): $!"; local $SIG{INT} = sub { kill -(SIGTERM) => $pid }; - plan tests => 5 unless $args{no_test}; + $Test->plan(tests => 5) unless $args{no_test}; my @tests = ( 'errors', 'definitely lost', 'indirectly lost', 'possibly lost', 'still reachable' ); my %res = map { $_ => 0 } @tests; while (<$rdr>) { - diag $_ if $args{diag}; + $Test->diag($_) if $args{diag}; if (/^=+\d+=+\s*FATAL\s*:\s*(.*)/) { chomp(my $err = $1); - diag "Valgrind error: $err"; + $Test->diag("Valgrind error: $err"); $res{$_} = undef for @tests; } if (/ERROR\s+SUMMARY\s*:\s+(\d+)/) { @@ -232,7 +234,7 @@ If your tests output to STDERR, everything will be eaten in the process. In part Valgrind 3.1.0 (L). -L, L (core modules since perl 5) and L (since 5.6.2). +L, L (core modules since perl 5) and L (since 5.6.2). L.