summaryrefslogtreecommitdiffstats
path: root/pigeonhole/tests/extensions/index/basic.svtest
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:36:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:36:47 +0000
commit0441d265f2bb9da249c7abf333f0f771fadb4ab5 (patch)
tree3f3789daa2f6db22da6e55e92bee0062a7d613fe /pigeonhole/tests/extensions/index/basic.svtest
parentInitial commit. (diff)
downloaddovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.tar.xz
dovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.zip
Adding upstream version 1:2.3.21+dfsg1.upstream/1%2.3.21+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pigeonhole/tests/extensions/index/basic.svtest')
-rw-r--r--pigeonhole/tests/extensions/index/basic.svtest93
1 files changed, 93 insertions, 0 deletions
diff --git a/pigeonhole/tests/extensions/index/basic.svtest b/pigeonhole/tests/extensions/index/basic.svtest
new file mode 100644
index 0000000..0706022
--- /dev/null
+++ b/pigeonhole/tests/extensions/index/basic.svtest
@@ -0,0 +1,93 @@
+require "vnd.dovecot.testsuite";
+require "index";
+require "date";
+require "variables";
+require "subaddress";
+
+test_set "message" text:
+To: first@friep.example.com
+X-A: First
+Received: from mx.example.com (127.0.0.13) by mx.example.org
+ (127.0.0.12) with Macrosoft SMTP Server (TLS) id 1.2.3.4;
+ Wed, 12 Nov 2014 18:18:31 +0100
+To: second@friep.example.com
+From: stephan@example.org
+Received: from mx.example.com (127.0.0.13) by mx.example.org
+ (127.0.0.12) with Macrosoft SMTP Server (TLS) id 1.2.3.4;
+ Wed, 12 Nov 2014 18:18:30 +0100
+X-A: Second
+To: third@friep.example.com
+X-A: Third
+Received: from mx.example.com (127.0.0.13) by mx.example.org
+ (127.0.0.12) with Macrosoft SMTP Server (TLS) id 1.2.3.4;
+ Wed, 12 Nov 2014 18:18:29 +0100
+Subject: Frop!
+X-A: Fourth
+To: fourth@friep.example.com
+Received: from mx.example.com (127.0.0.13) by mx.example.org
+ (127.0.0.12) with Macrosoft SMTP Server (TLS) id 1.2.3.4;
+ Wed, 12 Nov 2014 18:18:28 +0100
+
+Frop
+.
+;
+
+test "Header :index" {
+ if not header :index 3 "x-a" "Third" {
+ test_fail "wrong header retrieved";
+ }
+
+ if header :index 3 "x-a" ["First", "Second", "Fourth"] {
+ test_fail "other header retrieved";
+ }
+}
+
+test "Header :index :last" {
+ if not header :index 3 :last "x-a" "Second" {
+ test_fail "wrong header retrieved";
+ }
+
+ if header :index 3 :last "x-a" ["First", "Third", "Fourth"] {
+ test_fail "other header retrieved";
+ }
+}
+
+test "Address :index" {
+ if not address :localpart :index 2 "to" "second" {
+ test_fail "wrong header retrieved";
+ }
+
+ if address :localpart :index 2 "to" ["first", "third", "fourth"] {
+ test_fail "other header retrieved";
+ }
+}
+
+test "Address :index :last" {
+ if not address :localpart :index 2 :last "to" "third" {
+ test_fail "wrong header retrieved";
+ }
+
+ if address :localpart :index 2 :last "to" ["first", "second", "fourth"] {
+ test_fail "other header retrieved";
+ }
+}
+
+test "Date :index" {
+ if not date :index 1 "received" "second" "31" {
+ test_fail "wrong header retrieved";
+ }
+
+ if date :index 1 "received" "second" ["30", "29", "28"] {
+ test_fail "other header retrieved";
+ }
+}
+
+test "Date :index :last" {
+ if not date :index 1 :last "received" "second" "28"{
+ test_fail "wrong header retrieved";
+ }
+
+ if date :index 1 :last "received" "second" ["31", "30", "29"] {
+ test_fail "other header retrieved";
+ }
+}