- Rename "Block Test" directive to "Blocked URL".
authorFabian Keil <fk@fabiankeil.de>
Wed, 19 Mar 2008 16:19:20 +0000 (16:19 +0000)
committerFabian Keil <fk@fabiankeil.de>
Wed, 19 Mar 2008 16:19:20 +0000 (16:19 +0000)
- In get_final_results(), save the action parameter properly.
- In tokenize(), reverse HTML-encoding for ampersands.
- Allow tildes in check_for_forbidden_characters().

tools/privoxy-regression-test.pl

index 277d433..7bf82c1 100755 (executable)
@@ -7,7 +7,7 @@
 # A regression test "framework" for Privoxy. For documentation see:
 # perldoc privoxy-regression-test.pl
 #
-# $Id: privoxy-regression-test.pl,v 1.115 2008/03/18 22:07:34 fk Exp $
+# $Id: privoxy-regression-test.pl,v 1.118 2008/03/19 16:15:45 fk Exp $
 #
 # Wish list:
 #
@@ -144,7 +144,7 @@ sub parse_tag ($) {
 sub check_for_forbidden_characters ($) {
 
     my $tag = shift; # XXX: also used to check values though.
-    my $allowed = '[-=\dA-Za-z{}:.\/();\s,+@"_%\?&]';
+    my $allowed = '[-=\dA-Za-z~{}:.\/();\s,+@"_%\?&]';
 
     unless ($tag =~ m/^$allowed*$/) {
         my $forbidden = $tag;
@@ -191,7 +191,7 @@ sub token_starts_new_test ($) {
 
     my $token = shift;
     my @new_test_directives =
-        ('set header', 'fetch test', 'trusted cgi request', 'request header', 'method test', 'block test');
+        ('set header', 'fetch test', 'trusted cgi request', 'request header', 'method test', 'blocked url');
 
     foreach my $new_test_directive (@new_test_directives) {
         return 1 if $new_test_directive eq $token;
@@ -211,6 +211,7 @@ sub tokenize ($) {
     # Reverse HTML-encoding
     # XXX: Seriously imcomplete. 
     s@&quot;@"@g;
+    s@&amp;@&@g;
 
     # Tokenize
     if (/^\#\s*([^=:]*?)\s*[=]\s*(.*?)\s*$/) {
@@ -272,7 +273,7 @@ sub enlist_new_test ($$$$$$) {
         $$regression_tests[$si][$ri]{'expected-status-code'} = 200;
         $$regression_tests[$si][$ri]{'level'} = METHOD_TEST;
 
-    } elsif ($token eq 'block test') {
+    } elsif ($token eq 'blocked url') {
 
         l(LL_FILE_LOADING, "URL to block-test: " . $value);
         $$regression_tests[$si][$ri]{'type'} = BLOCK_TEST;
@@ -667,7 +668,7 @@ sub get_final_results ($) {
         if (m@<br>([-+])<a.*>([^>]*)</a>( \{.*\})@) {
             my $action = $1.$2;
             my $value = $3;
-            $final_results{$action}{$value};
+            $final_results{$action} = $value;
         }
     }