X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F30-skip.t;fp=t%2F30-skip.t;h=f693a29822c705fc1f3cd86bc7674c226e33a165;hb=5b7da288da2757d62ecaa3de0c40ea876ef9be2b;hp=0000000000000000000000000000000000000000;hpb=15e7706165e33a1e52fba63877a92613ff1794a8;p=perl%2Fmodules%2FTest-Valgrind.git diff --git a/t/30-skip.t b/t/30-skip.t new file mode 100644 index 0000000..f693a29 --- /dev/null +++ b/t/30-skip.t @@ -0,0 +1,51 @@ +#!perl + +use strict; +use warnings; + +use lib 't/lib'; +use VPIT::TestHelpers 'capture'; + +use Test::More tests => 3; + +use Test::Valgrind::FakeValgrind; + +SKIP: { + my ($stat, $out, $err) = capture_perl 'BEGIN { delete $ENV{PATH} } use Test::Valgrind; 1'; + skip CAPTURE_PERL_FAILED($out) => 1 unless defined $stat; + like $out, qr/^1..0 # SKIP Empty valgrind candidates list/, + 'correctly skip when no valgrind is available'; +} + +SKIP: { + skip 'Only on linux or darwin' => 1 unless $^O eq 'linux' or $^O eq 'darwin'; + + my $old_vg = Test::Valgrind::FakeValgrind->new( + exe_name => 'valgrind', + version => '3.0.0', + ); + skip $old_vg => 1 unless ref $old_vg; + my $tmp_dir = $old_vg->dir; + + my ($stat, $out, $err) = capture_perl "BEGIN { \$ENV{PATH} = q[$tmp_dir] } use Test::Valgrind; 1"; + skip CAPTURE_PERL_FAILED($out) => 1 unless defined $stat; + like $out, qr/^1..0 # SKIP No appropriate valgrind executable could be found/, + 'correctly skip when no good valgrind was found'; +} + +SKIP: { + skip 'Only on linux or darwin' => 1 unless $^O eq 'linux' or $^O eq 'darwin'; + + my $new_vg = Test::Valgrind::FakeValgrind->new( + exe_name => 'valgrind', + version => '3.4.0', + ); + skip $new_vg => 1 unless ref $new_vg; + my $tmp_dir = $new_vg->dir; + + my ($stat, $out, $err) = capture_perl "BEGIN { \$ENV{PATH} = q[$tmp_dir] } use Test::Valgrind no_def_supp => 1, extra_supps => [ q[t/supp/no_perl] ]; 1"; + skip CAPTURE_PERL_FAILED($out) => 1 unless defined $stat; + like $out, qr/^1..0 # SKIP No compatible suppressions available/, + 'correctly skip when no compatible suppressions were available'; +} +