[PATCH 4/4 v43] test: Add address cleaning tests.
authorDavid Edmondson <dme@dme.org>
Tue, 24 Jan 2012 16:14:07 +0000 (16:14 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:43:08 +0000 (09:43 -0800)
a3/308c8c7b805767bcc776ce0cb4d52133b764e8 [new file with mode: 0644]

diff --git a/a3/308c8c7b805767bcc776ce0cb4d52133b764e8 b/a3/308c8c7b805767bcc776ce0cb4d52133b764e8
new file mode 100644 (file)
index 0000000..d7f53a0
--- /dev/null
@@ -0,0 +1,143 @@
+Return-Path: <dme@dme.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id D14A8431FD2\r
+       for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 08:14:32 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id TI19JItTmeTT for <notmuch@notmuchmail.org>;\r
+       Tue, 24 Jan 2012 08:14:31 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id A80CA431FDE\r
+       for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 08:14:31 -0800 (PST)\r
+Received: by wibhi8 with SMTP id hi8so1696248wib.26\r
+       for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 08:14:30 -0800 (PST)\r
+Received: by 10.180.99.225 with SMTP id et1mr21947023wib.2.1327421670547;\r
+       Tue, 24 Jan 2012 08:14:30 -0800 (PST)\r
+Received: from hotblack-desiato.hh.sledj.net\r
+       (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
+       by mx.google.com with ESMTPS id n3sm53821973wiz.9.2012.01.24.08.14.28\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Tue, 24 Jan 2012 08:14:28 -0800 (PST)\r
+Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
+       id 0FEF59FD49; Tue, 24 Jan 2012 16:14:27 +0000 (GMT)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 4/4 v43] test: Add address cleaning tests.\r
+Date: Tue, 24 Jan 2012 16:14:07 +0000\r
+Message-Id: <1327421647-30405-5-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.8.3\r
+In-Reply-To: <1327421647-30405-1-git-send-email-dme@dme.org>\r
+References: <1326804748-8989-2-git-send-email-dme@dme.org>\r
+       <1327421647-30405-1-git-send-email-dme@dme.org>\r
+MIME-Version: 1.0\r
+X-Gm-Message-State:\r
+ ALoCoQkhH5c+u74AooZwt6AfqQxrzCGDPQbUEKZDyoBjdHTw2tzXpn9fnL9UchHhMeaPxeX9cHt0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 24 Jan 2012 16:14:33 -0000\r
+\r
+---\r
+ test/emacs-address-cleaning.el |   29 +++++++++++++++++++++++++++++\r
+ test/emacs-address-cleaning.sh |   19 +++++++++++++++++++\r
+ test/notmuch-test              |    1 +\r
+ 3 files changed, 49 insertions(+), 0 deletions(-)\r
+ create mode 100644 test/emacs-address-cleaning.el\r
+ create mode 100755 test/emacs-address-cleaning.sh\r
+\r
+diff --git a/test/emacs-address-cleaning.el b/test/emacs-address-cleaning.el\r
+new file mode 100644\r
+index 0000000..19e9e05\r
+--- /dev/null\r
++++ b/test/emacs-address-cleaning.el\r
+@@ -0,0 +1,29 @@\r
++(defun notmuch-test-address-cleaning-1 ()\r
++  (notmuch-test-expect-equal (notmuch-show-clean-address "dme@dme.org")\r
++                      "dme@dme.org"))\r
++\r
++(defun notmuch-test-address-cleaning-2 ()\r
++  (let* ((input '("foo@bar.com"\r
++                "<foo@bar.com>"\r
++                "Foo Bar <foo@bar.com>"\r
++                "foo@bar.com <foo@bar.com>"\r
++                "\"Foo Bar\" <foo@bar.com>"))\r
++       (expected '("foo@bar.com"\r
++                   "foo@bar.com"\r
++                   "Foo Bar <foo@bar.com>"\r
++                   "foo@bar.com"\r
++                   "Foo Bar <foo@bar.com>"))\r
++       (output (mapcar #'notmuch-show-clean-address input)))\r
++    (notmuch-test-expect-equal output expected)))\r
++\r
++(defun notmuch-test-address-cleaning-3 ()\r
++  (let* ((input '("ДБ <db-uknot@stop.me.uk>"\r
++                "foo (at home) <foo@bar.com>"\r
++                "foo [at home] <foo@bar.com>"\r
++                "Foo Bar"))\r
++       (expected '("ДБ <db-uknot@stop.me.uk>"\r
++                   "foo (at home) <foo@bar.com>"\r
++                   "foo [at home] <foo@bar.com>"\r
++                   "Foo Bar"))\r
++       (output (mapcar #'notmuch-show-clean-address input)))\r
++    (notmuch-test-expect-equal output expected)))\r
+diff --git a/test/emacs-address-cleaning.sh b/test/emacs-address-cleaning.sh\r
+new file mode 100755\r
+index 0000000..0d85bdc\r
+--- /dev/null\r
++++ b/test/emacs-address-cleaning.sh\r
+@@ -0,0 +1,19 @@\r
++#!/usr/bin/env bash\r
++\r
++test_description="emacs address cleaning"\r
++. test-lib.sh\r
++\r
++test_begin_subtest "notmuch-test-address-clean part 1"\r
++test_emacs_expect_t \\r
++    '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-1)'\r
++\r
++test_begin_subtest "notmuch-test-address-clean part 2"\r
++test_emacs_expect_t \\r
++    '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-2)'\r
++\r
++test_begin_subtest "notmuch-test-address-clean part 3"\r
++test_subtest_known_broken\r
++test_emacs_expect_t \\r
++    '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-3)'\r
++\r
++test_done\r
+diff --git a/test/notmuch-test b/test/notmuch-test\r
+index d034f99..3f1740c 100755\r
+--- a/test/notmuch-test\r
++++ b/test/notmuch-test\r
+@@ -53,6 +53,7 @@ TESTS="\r
+   hooks\r
+   argument-parsing\r
+   emacs-test-functions.sh\r
++  emacs-address-cleaning.sh\r
+ "\r
+ TESTS=${NOTMUCH_TESTS:=$TESTS}\r
\r
+-- \r
+1.7.8.3\r
+\r