require "vnd.dovecot.testsuite"; require "date"; require "variables"; require "relational"; test_set "message" text: From: stephan@example.org To: sirius@friep.example.com Subject: Frop! Date: Mon, 20 Jul 2009 21:44:43 +0300 Delivery-Date: Mon, 22 Jul 2009 23:30:14 +0300 Invalid-Date: Moo, 34 Juul 3060 25:30:42 +6600 Wanna date? . ; test "Defaults" { if not date :originalzone "date" "std11" "mon, 20 jul 2009 21:44:43 +0300" { test_fail "default comparator is not i;ascii-casemap"; } if anyof ( date "date" "std11" "Mon", date "date" "std11" "*") { test_fail "default match type appears to be :contains or :matches"; } } test "Count" { if not date :count "eq" "date" "date" "1" { test_fail "count of existing date header field is not 1"; } if not date :count "eq" "resent-date" "date" "0" { test_fail "count of non-existent date header field is not 0"; } } test "Invalid" { if date :matches "invalid-date" "std11" "*" { test_fail "matched invalid date: ${0}"; } }