You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by du...@apache.org on 2008/09/16 23:55:58 UTC
svn commit: r696083 - /spamassassin/trunk/t/SATest.pm
Author: duncf
Date: Tue Sep 16 14:55:58 2008
New Revision: 696083
URL: http://svn.apache.org/viewvc?rev=696083&view=rev
Log:
Make ok_all_patterns/skip_all_patterns test failures give line numbers of caller for easier debugging.
Modified:
spamassassin/trunk/t/SATest.pm
Modified: spamassassin/trunk/t/SATest.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/SATest.pm?rev=696083&r1=696082&r2=696083&view=diff
==============================================================================
--- spamassassin/trunk/t/SATest.pm (original)
+++ spamassassin/trunk/t/SATest.pm Tue Sep 16 14:55:58 2008
@@ -687,17 +687,17 @@
sub ok_all_patterns {
my ($dont_ok) = shift;
-
+ my (undef, $file, $line) = caller();
my $wasfailure = 0;
foreach my $pat (sort keys %patterns) {
my $type = $patterns{$pat};
print "\tChecking $type\n";
if (defined $found{$type}) {
if (!$dont_ok) {
- ok ($found{$type} == 1) or warn "Found more than once: $type\n";
+ ok ($found{$type} == 1) or warn "Found more than once: $type at $file line $line.\n";
}
} else {
- warn "\tNot found: $type = $pat\n";
+ warn "\tNot found: $type = $pat at $file line $line.\n";
if (!$dont_ok) {
ok (0); # keep the right # of tests
}
@@ -706,9 +706,9 @@
}
foreach my $pat (sort keys %anti_patterns) {
my $type = $anti_patterns{$pat};
- print "\tChecking for anti-pattern $type\n";
+ print "\tChecking for anti-pattern $type at $file line $line.\n";
if (defined $found_anti{$type}) {
- warn "\tFound anti-pattern: $type = $pat\n";
+ warn "\tFound anti-pattern: $type = $pat at $file line $line.\n";
if (!$dont_ok) { ok (0); }
$wasfailure++;
}
@@ -728,17 +728,18 @@
sub skip_all_patterns {
my $skip = shift;
+ my (undef, $file, $line) = caller();
foreach my $pat (sort keys %patterns) {
my $type = $patterns{$pat};
print "\tChecking $type\n";
if (defined $found{$type}) {
- skip ($skip, $found{$type} == 1) or warn "Found more than once: $type\n";
- warn "\tThis test should have been skipped: $skip\n" if $skip;
+ skip ($skip, $found{$type} == 1) or warn "Found more than once: $type at $file line $line.\n";
+ warn "\tThis test should have been skipped: $skip at $file line $line.\n" if $skip;
} else {
if ($skip) {
- warn "\tTest skipped: $skip\n";
+ warn "\tTest skipped: $skip at $file line $line.\n";
} else {
- warn "\tNot found: $type = $pat\n";
+ warn "\tNot found: $type = $pat at $file line $line.\n";
}
skip ($skip, 0); # keep the right # of tests
}
@@ -747,7 +748,7 @@
my $type = $anti_patterns{$pat};
print "\tChecking for anti-pattern $type\n";
if (defined $found_anti{$type}) {
- warn "\tFound anti-pattern: $type = $pat\n";
+ warn "\tFound anti-pattern: $type = $pat at $file line $line.\n";
skip ($skip, 0);
}
else