]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blob - t/10-suppressions.t
Output what we got when t/30-bad.t fails
[perl/modules/Test-Valgrind.git] / t / 10-suppressions.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5 use Test::More tests => 3;
6
7 use lib qw{blib/archpub};
8 use Test::Valgrind::Suppressions qw/supp_path VG_PATH/;
9
10 my $path = supp_path();
11 like($path, qr!Test/Valgrind/perlTestValgrind\.supp$!,
12      'supppath() returns the path to the suppression file');
13
14 isnt(VG_PATH, undef, 'VG_PATH is defined');
15
16 if (not open my $supp, '<', $path) {
17  fail("Couldn't open the suppression file at $path: $!");
18 } else {
19  pass("Could open the suppression file");
20  my ($in, $count, $true, $line) = (0, 0, 0, 0);
21  while (<$supp>) {
22   ++$line;
23   chomp;
24   s/^\s*//;
25   s/\s*$//;
26   if (!$in && $_ eq '{') {
27    $in = $line;
28   } elsif ($in && $_ eq '}') {
29    ++$count;
30    ++$true if $line - $in >= 2;
31    $in = 0;
32   }
33  }
34  diag "$count suppressions, of which $true are not empty";
35  close $supp;
36 }