You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2005/01/30 18:37:11 UTC

svn commit: r149125 - /spamassassin/trunk/t/rule_tests.t

Author: felicity
Date: Sun Jan 30 09:37:08 2005
New Revision: 149125

URL: http://svn.apache.org/viewcvs?view=rev&rev=149125
Log:
fix for rule test failures: tests for headers like 'From:addr' weren't hitting
because 'From:addr' became the header name, strip off the ':.*$'...  during
debugging, found a test using 'ARRAY(....)'.  wrote in some code to bring it
down to a string, and try to figure out if it should be a 'Received' header.
added some commented out debug code as well.

Modified:
   spamassassin/trunk/t/rule_tests.t

Modified: spamassassin/trunk/t/rule_tests.t
Url: http://svn.apache.org/viewcvs/spamassassin/trunk/t/rule_tests.t?view=diff&rev=149125&p1=spamassassin/trunk/t/rule_tests.t&r1=149124&p2=spamassassin/trunk/t/rule_tests.t&r2=149125
==============================================================================
--- spamassassin/trunk/t/rule_tests.t	(original)
+++ spamassassin/trunk/t/rule_tests.t	Sun Jan 30 09:37:08 2005
@@ -67,7 +67,12 @@
 		|| $sa->{conf}->{head_evals}->{$priority}->{$symbol};
 	      last if $test_string;
             }
+	    if (ref($test_string) eq 'ARRAY'){
+	      $test_string = join("_", @{$test_string});
+	      $test_string = "Received" if ($test_string =~ /received/i);
+	    }
             my ($header_name) = $test_string =~ /^(\S+)/;
+	    $header_name =~ s/:.*$//; # :name, :addr, etc.
             # warn("got header name: $header_name - setting to: $string\n");
 	    $mail = $sa->parse(["${header_name}: $string\n","\n","\n"]);
         }
@@ -83,6 +88,9 @@
 	    $mail = $sa->parse(["Content-type: $type\n","\n","$string\n"]);
         }
 
+	# debugging, what message is being processed
+	#print $symbol, "\n", "-"x48, "\n", $mail->get_pristine(), "\n", "-"x48, "\n";
+
         my $msg = Mail::SpamAssassin::PerMsgStatus->new($sa, $mail);
         my $conf = $msg->{conf};
 
@@ -97,6 +105,9 @@
 
 	my %rules_hit = map { $_ => 1 } split(/,/,$msg->get_names_of_tests_hit()),
 		split(/,/,$msg->get_names_of_subtests_hit());
+
+	# debugging, what rule hits actually occurred
+	#print $symbol, ": ", join(", ", keys(%rules_hit), "\n");
 
         ok( (exists $rules_hit{$symbol} ? 1 : 0), ($ok_or_fail eq 'ok' ? 1 : 0),
                 "Test for '$symbol' (type: $test_type) against '$string'" );