[PATCH 2/8] lib: private string map (associative array) API
[notmuch-archives.git] / 7a / 868fb0cee12f4830ca287f517c28f1848f4c73
1 Return-Path: <hohndel@gr8dns.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 A8B24418C25\r
6         for <notmuch@notmuchmail.org>; Wed, 21 Apr 2010 14:56:27 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.9\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
12         tests=[BAYES_00=-1.9] autolearn=ham\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 b3kWWHS4e1HE for <notmuch@notmuchmail.org>;\r
16         Wed, 21 Apr 2010 14:56:26 -0700 (PDT)\r
17 Received: from mail.hohndel.org (mail.hohndel.org [65.23.157.147])\r
18         by olra.theworths.org (Postfix) with ESMTP id 82755431FC1\r
19         for <notmuch@notmuchmail.org>; Wed, 21 Apr 2010 14:56:26 -0700 (PDT)\r
20 Received: by mail.hohndel.org (Postfix, from userid 112)\r
21         id 3F4C7340FA; Wed, 21 Apr 2010 17:56:26 -0400 (EDT)\r
22 Received: from x200.gr8dns.org (unknown [65.23.157.147])\r
23         by mail.hohndel.org (Postfix) with ESMTP id F1575340F4;\r
24         Wed, 21 Apr 2010 17:56:24 -0400 (EDT)\r
25 Received: by x200.gr8dns.org (Postfix, from userid 500)\r
26         id B6A3CC0212; Wed, 21 Apr 2010 14:56:24 -0700 (PDT)\r
27 From: Dirk Hohndel <hohndel@infradead.org>\r
28 To: <notmuch@notmuchmail.org>\r
29 Subject: [PATCH 1/2] add From guessing tests to test suite\r
30 Date: Wed, 21 Apr 2010 14:55:57 -0700\r
31 Message-Id: <1271886958-3276-2-git-send-email-hohndel@infradead.org>\r
32 X-Mailer: git-send-email 1.6.6.1\r
33 In-Reply-To: <1271886958-3276-1-git-send-email-hohndel@infradead.org>\r
34 References: <1271886958-3276-1-git-send-email-hohndel@infradead.org>\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.13\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39         <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Wed, 21 Apr 2010 21:56:27 -0000\r
48 \r
49 right now these are not trying to be overly fancy\r
50 simply one test per strategy that we apply to figure out the best\r
51 from address - including the fallback if there's nothing to go on\r
52 \r
53 Signed-off-by: Dirk Hohndel <hohndel@infradead.org>\r
54 ---\r
55  test/notmuch-test |  103 ++++++++++++++++++++++++++++++++++++++++++++++++++++-\r
56  1 files changed, 102 insertions(+), 1 deletions(-)\r
57 \r
58 diff --git a/test/notmuch-test b/test/notmuch-test\r
59 index 53ee189..855850c 100755\r
60 --- a/test/notmuch-test\r
61 +++ b/test/notmuch-test\r
62 @@ -60,6 +60,7 @@ increment_mtime ()\r
63  #  '[cc]="Some User <user@example.com>"'\r
64  #  [reply-to]=some-address\r
65  #  [in-reply-to]=<message-id>\r
66 +#  '[header]=full header line, including keyword'\r
67  #\r
68  #      Additional values for email headers. If these are not provided\r
69  #      then the relevant headers will simply not appear in the\r
70 @@ -114,6 +115,11 @@ generate_message ()\r
71      fi\r
72  \r
73      additional_headers=""\r
74 +    if [ ! -z "${template[header]}" ]; then\r
75 +       additional_headers="${template[header]}\r
76 +${additional_headers}"\r
77 +    fi\r
78 +\r
79      if [ ! -z "${template[reply-to]}" ]; then\r
80         additional_headers="Reply-To: ${template[reply-to]}\r
81  ${additional_headers}"\r
82 @@ -129,6 +135,7 @@ ${additional_headers}"\r
83  ${additional_headers}"\r
84      fi\r
85  \r
86 +\r
87  cat <<EOF >$gen_msg_filename\r
88  From: ${template[from]}\r
89  To: ${template[to]}\r
90 @@ -203,7 +210,7 @@ path=${MAIL_DIR}\r
91  [user]\r
92  name=Notmuch Test Suite\r
93  primary_email=test_suite@notmuchmail.org\r
94 -other_email=test_suite_other@notmuchmail.org\r
95 +other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org\r
96  EOF\r
97  \r
98  printf "Testing \"notmuch new\" in several variations:\n"\r
99 @@ -629,6 +636,100 @@ printf " Searching returns all three messages in one thread..."\r
100  output=$($NOTMUCH search foo | notmuch_search_sanitize)\r
101  pass_if_equal "$output" "thread:XXX   2000-01-01 [3/3] Notmuch Test Suite; brokenthreadtest (inbox unread)"\r
102  \r
103 +printf " Magic from guessing (nothing to go on)...\t"\r
104 +add_message '[from]="Sender <sender@example.com>"' \\r
105 +             [to]=mailinglist@notmuchmail.org \\r
106 +             [subject]=notmuch-reply-test \\r
107 +            '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \\r
108 +            '[body]="from guessing test"'\r
109 +\r
110 +output=$($NOTMUCH reply id:${gen_msg_id})\r
111 +pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
112 +Subject: Re: notmuch-reply-test\r
113 +To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
114 +In-Reply-To: <${gen_msg_id}>\r
115 +References: <${gen_msg_id}>\r
116 +\r
117 +On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
118 +> from guessing test"\r
119 +\r
120 +printf " Magic from guessing (Envelope-to:)...\t\t"\r
121 +add_message '[from]="Sender <sender@example.com>"' \\r
122 +             [to]=mailinglist@notmuchmail.org \\r
123 +             [subject]=notmuch-reply-test \\r
124 +            '[header]="Envelope-To: test_suite_other@notmuchmail.org"' \\r
125 +            '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \\r
126 +            '[body]="from guessing test"'\r
127 +\r
128 +output=$($NOTMUCH reply id:${gen_msg_id})\r
129 +pass_if_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>\r
130 +Subject: Re: notmuch-reply-test\r
131 +To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
132 +In-Reply-To: <${gen_msg_id}>\r
133 +References: <${gen_msg_id}>\r
134 +\r
135 +On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
136 +> from guessing test"\r
137 +\r
138 +printf " Magic from guessing (X-Original-To:)...\t"\r
139 +add_message '[from]="Sender <sender@example.com>"' \\r
140 +             [to]=mailinglist@notmuchmail.org \\r
141 +             [subject]=notmuch-reply-test \\r
142 +            '[header]="X-Original-To: test_suite_other@notmuchmail.org"' \\r
143 +            '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \\r
144 +            '[body]="from guessing test"'\r
145 +\r
146 +output=$($NOTMUCH reply id:${gen_msg_id})\r
147 +pass_if_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>\r
148 +Subject: Re: notmuch-reply-test\r
149 +To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
150 +In-Reply-To: <${gen_msg_id}>\r
151 +References: <${gen_msg_id}>\r
152 +\r
153 +On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
154 +> from guessing test"\r
155 +\r
156 +printf " Magic from guessing (Received: .. for ..)...\t"\r
157 +add_message '[from]="Sender <sender@example.com>"' \\r
158 +             [to]=mailinglist@notmuchmail.org \\r
159 +             [subject]=notmuch-reply-test \\r
160 +            '[header]="Received: from mail.example.com (mail.example.com [1.1.1.1])\\r
161 +        by mail.notmuchmail.org (some MTA) with ESMTP id 12345678\\r
162 +        for <test_suite_other@notmuchmail.org>; Sat, 10 Apr 2010 07:54:51 -0400 (EDT)"' \\r
163 +            '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \\r
164 +            '[body]="from guessing test"'\r
165 +\r
166 +output=$($NOTMUCH reply id:${gen_msg_id})\r
167 +pass_if_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>\r
168 +Subject: Re: notmuch-reply-test\r
169 +To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
170 +In-Reply-To: <${gen_msg_id}>\r
171 +References: <${gen_msg_id}>\r
172 +\r
173 +On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
174 +> from guessing test"\r
175 +\r
176 +printf " Magic from guessing (Received: domain)...\t"\r
177 +add_message '[from]="Sender <sender@example.com>"' \\r
178 +             [to]=mailinglist@notmuchmail.org \\r
179 +             [subject]=notmuch-reply-test \\r
180 +            '[header]="Received: from mail.example.com (mail.example.com [1.1.1.1])\\r
181 +        by mail.otherdomain.org (some MTA) with ESMTP id 12345678\\r
182 +        Sat, 10 Apr 2010 07:54:51 -0400 (EDT)"' \\r
183 +            '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \\r
184 +            '[body]="from guessing test"'\r
185 +\r
186 +output=$($NOTMUCH reply id:${gen_msg_id})\r
187 +pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@otherdomain.org>\r
188 +Subject: Re: notmuch-reply-test\r
189 +To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
190 +In-Reply-To: <${gen_msg_id}>\r
191 +References: <${gen_msg_id}>\r
192 +\r
193 +On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
194 +> from guessing test"\r
195 +\r
196 +\r
197  echo ""\r
198  echo "Notmuch test suite complete."\r
199  \r
200 -- \r
201 1.6.6.1\r
202 \r