Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / a3 / 308c8c7b805767bcc776ce0cb4d52133b764e8
1 Return-Path: <dme@dme.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id D14A8431FD2\r
6         for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 08:14:32 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id TI19JItTmeTT for <notmuch@notmuchmail.org>;\r
16         Tue, 24 Jan 2012 08:14:31 -0800 (PST)\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
18         [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id A80CA431FDE\r
21         for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 08:14:31 -0800 (PST)\r
22 Received: by wibhi8 with SMTP id hi8so1696248wib.26\r
23         for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 08:14:30 -0800 (PST)\r
24 Received: by 10.180.99.225 with SMTP id et1mr21947023wib.2.1327421670547;\r
25         Tue, 24 Jan 2012 08:14:30 -0800 (PST)\r
26 Received: from hotblack-desiato.hh.sledj.net\r
27         (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
28         by mx.google.com with ESMTPS id n3sm53821973wiz.9.2012.01.24.08.14.28\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Tue, 24 Jan 2012 08:14:28 -0800 (PST)\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
32         id 0FEF59FD49; Tue, 24 Jan 2012 16:14:27 +0000 (GMT)\r
33 From: David Edmondson <dme@dme.org>\r
34 To: notmuch@notmuchmail.org\r
35 Subject: [PATCH 4/4 v43] test: Add address cleaning tests.\r
36 Date: Tue, 24 Jan 2012 16:14:07 +0000\r
37 Message-Id: <1327421647-30405-5-git-send-email-dme@dme.org>\r
38 X-Mailer: git-send-email 1.7.8.3\r
39 In-Reply-To: <1327421647-30405-1-git-send-email-dme@dme.org>\r
40 References: <1326804748-8989-2-git-send-email-dme@dme.org>\r
41         <1327421647-30405-1-git-send-email-dme@dme.org>\r
42 MIME-Version: 1.0\r
43 X-Gm-Message-State:\r
44  ALoCoQkhH5c+u74AooZwt6AfqQxrzCGDPQbUEKZDyoBjdHTw2tzXpn9fnL9UchHhMeaPxeX9cHt0\r
45 Content-Type: text/plain; charset=UTF-8\r
46 Content-Transfer-Encoding: 8bit\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.13\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51         <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Tue, 24 Jan 2012 16:14:33 -0000\r
60 \r
61 ---\r
62  test/emacs-address-cleaning.el |   29 +++++++++++++++++++++++++++++\r
63  test/emacs-address-cleaning.sh |   19 +++++++++++++++++++\r
64  test/notmuch-test              |    1 +\r
65  3 files changed, 49 insertions(+), 0 deletions(-)\r
66  create mode 100644 test/emacs-address-cleaning.el\r
67  create mode 100755 test/emacs-address-cleaning.sh\r
68 \r
69 diff --git a/test/emacs-address-cleaning.el b/test/emacs-address-cleaning.el\r
70 new file mode 100644\r
71 index 0000000..19e9e05\r
72 --- /dev/null\r
73 +++ b/test/emacs-address-cleaning.el\r
74 @@ -0,0 +1,29 @@\r
75 +(defun notmuch-test-address-cleaning-1 ()\r
76 +  (notmuch-test-expect-equal (notmuch-show-clean-address "dme@dme.org")\r
77 +                       "dme@dme.org"))\r
78 +\r
79 +(defun notmuch-test-address-cleaning-2 ()\r
80 +  (let* ((input '("foo@bar.com"\r
81 +                 "<foo@bar.com>"\r
82 +                 "Foo Bar <foo@bar.com>"\r
83 +                 "foo@bar.com <foo@bar.com>"\r
84 +                 "\"Foo Bar\" <foo@bar.com>"))\r
85 +        (expected '("foo@bar.com"\r
86 +                    "foo@bar.com"\r
87 +                    "Foo Bar <foo@bar.com>"\r
88 +                    "foo@bar.com"\r
89 +                    "Foo Bar <foo@bar.com>"))\r
90 +        (output (mapcar #'notmuch-show-clean-address input)))\r
91 +    (notmuch-test-expect-equal output expected)))\r
92 +\r
93 +(defun notmuch-test-address-cleaning-3 ()\r
94 +  (let* ((input '("ДБ <db-uknot@stop.me.uk>"\r
95 +                 "foo (at home) <foo@bar.com>"\r
96 +                 "foo [at home] <foo@bar.com>"\r
97 +                 "Foo Bar"))\r
98 +        (expected '("ДБ <db-uknot@stop.me.uk>"\r
99 +                    "foo (at home) <foo@bar.com>"\r
100 +                    "foo [at home] <foo@bar.com>"\r
101 +                    "Foo Bar"))\r
102 +        (output (mapcar #'notmuch-show-clean-address input)))\r
103 +    (notmuch-test-expect-equal output expected)))\r
104 diff --git a/test/emacs-address-cleaning.sh b/test/emacs-address-cleaning.sh\r
105 new file mode 100755\r
106 index 0000000..0d85bdc\r
107 --- /dev/null\r
108 +++ b/test/emacs-address-cleaning.sh\r
109 @@ -0,0 +1,19 @@\r
110 +#!/usr/bin/env bash\r
111 +\r
112 +test_description="emacs address cleaning"\r
113 +. test-lib.sh\r
114 +\r
115 +test_begin_subtest "notmuch-test-address-clean part 1"\r
116 +test_emacs_expect_t \\r
117 +    '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-1)'\r
118 +\r
119 +test_begin_subtest "notmuch-test-address-clean part 2"\r
120 +test_emacs_expect_t \\r
121 +    '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-2)'\r
122 +\r
123 +test_begin_subtest "notmuch-test-address-clean part 3"\r
124 +test_subtest_known_broken\r
125 +test_emacs_expect_t \\r
126 +    '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-3)'\r
127 +\r
128 +test_done\r
129 diff --git a/test/notmuch-test b/test/notmuch-test\r
130 index d034f99..3f1740c 100755\r
131 --- a/test/notmuch-test\r
132 +++ b/test/notmuch-test\r
133 @@ -53,6 +53,7 @@ TESTS="\r
134    hooks\r
135    argument-parsing\r
136    emacs-test-functions.sh\r
137 +  emacs-address-cleaning.sh\r
138  "\r
139  TESTS=${NOTMUCH_TESTS:=$TESTS}\r
140  \r
141 -- \r
142 1.7.8.3\r
143 \r