]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - t/10-suppressions.t
Get infos from the suppression files in t/10-suppressions.t, so that we get useful...
[perl/modules/Test-Valgrind.git] / t / 10-suppressions.t
index 9dc37d9e73ff75131c01bedf5c25f3673d67579a..04484002bc242a3fb8ba3a573ca9d951313792a6 100644 (file)
@@ -2,10 +2,35 @@
 
 use strict;
 use warnings;
-use Test::More tests => 1;
+use Test::More tests => 3;
 
-use Test::Valgrind::Suppressions qw/supppath/;
+use lib qw{blib/archpub};
+use Test::Valgrind::Suppressions qw/supp_path VG_PATH/;
 
-my $path = supppath();
+my $path = supp_path();
 like($path, qr!Test/Valgrind/perlTestValgrind\.supp$!,
      'supppath() returns the path to the suppression file');
+
+isnt(VG_PATH, undef, 'VG_PATH is defined');
+
+if (not open my $supp, '<', $path) {
+ fail("Couldn't open the suppression file at $path: $!");
+} else {
+ pass("Could open the suppression file");
+ my ($in, $count, $true, $line) = (0, 0, 0, 0);
+ while (<$supp>) {
+  ++$line;
+  chomp;
+  s/^\s*//;
+  s/\s*$//;
+  if (!$in && $_ eq '{') {
+   $in = $line;
+  } elsif ($in && $_ eq '}') {
+   ++$count;
+   ++$true if $line - $in >= 2;
+   $in = 0;
+  }
+ }
+ diag "$count suppressions, of which $true are not empty";
+ close $supp;
+}