From 141727dd54a4a2caa900118ca96cb085993ad663 Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Sun, 29 Jun 2008 20:57:42 +0200
Subject: [PATCH] Testsuite: extended :matches tests.

---
 .../tests/match-types/matches.svtest          | 38 ++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/testsuite/tests/match-types/matches.svtest b/src/testsuite/tests/match-types/matches.svtest
index ea9bcb2b8..a808520c5 100644
--- a/src/testsuite/tests/match-types/matches.svtest
+++ b/src/testsuite/tests/match-types/matches.svtest
@@ -8,7 +8,7 @@ Cc: me@example.com
 Cc: timo@dovecot.com
 X-Hufter: TRUE
 Subject: make your money very fast!!!
-X-Spam-Score: 300
+X-Spam-Score: **********
 X-Bullshit: 33333???a
 Message-ID: <90a02fe01fc25e131d0e9c4c45975894@example.com>
 
@@ -85,6 +85,30 @@ test "MATCH-K" {
 	}
 }
 
+test "MATCH-L" {
+	if not header :matches "x-spam-score" "\\*\\*\\*\\*\\**" {
+		test_fail "should have matched";
+	}
+}
+
+test "MATCH-M" {
+	if not header :matches "x-spam-score" "\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*" {
+		test_fail "should have matched";
+	}
+}
+
+test "MATCH-N" {
+	if not header :matches "x-spam-score" "\\*\\*\\***\\*\\*" {
+		test_fail "should have matched";
+	}
+}
+
+test "MATCH-O" {
+	if not header :matches "x-spam-score" "\\*?\\*?\\*?\\*?\\*?" {
+		test_fail "should have matched";
+	}
+}
+
 # Non-matching tests
 
 test "NO-MATCH-A" {
@@ -153,3 +177,15 @@ test "NO-MATCH-K" {
 	}
 }
 
+test "NO-MATCH-L" {
+	if header :matches "x-spam-score" "\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*" {
+		test_fail "should not have matched";
+	}
+}
+
+
+test "NO-MATCH-M" {
+	if header :matches "x-spam-score" "\\*?\\*?\\*?\\*?\\*??" {
+		test_fail "should not have matched";
+	}
+}
-- 
GitLab