Re: [PATCH] Fix typo in Message.maildir_flags_to_tags
[notmuch-archives.git] / 16 / 47004c2c960e3455176a3e7940c45ac1419a3a
1 Return-Path: <gregor@sam.mediasupervision.de>\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 8CE894196F2\r
6         for <notmuch@notmuchmail.org>; Tue, 13 Apr 2010 09:37:58 -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: 0.8\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.8 tagged_above=-999 required=5 tests=[BAYES_50=0.8]\r
12         autolearn=unavailable\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 w5bepLb46qVi for <notmuch@notmuchmail.org>;\r
16         Tue, 13 Apr 2010 09:37:58 -0700 (PDT)\r
17 Received: from sam.mediasupervision.de (sam.mediasupervision.de\r
18  [80.152.3.104])        by olra.theworths.org (Postfix) with ESMTP id 25FF6431FC1       for\r
19  <notmuch@notmuchmail.org>; Tue, 13 Apr 2010 09:37:58 -0700 (PDT)\r
20 Received: from localhost (sam.mediasupervision.de [127.0.0.1])\r
21         by sam.mediasupervision.de (Postfix) with ESMTP id 82F35485C67\r
22         for <notmuch@notmuchmail.org>; Tue, 13 Apr 2010 18:37:57 +0200 (CEST)\r
23 X-Virus-Scanned: Debian amavisd-new at sam.mediasupervision.de\r
24 Received: from sam.mediasupervision.de ([127.0.0.1])\r
25         by localhost (sam.mediasupervision.de [127.0.0.1]) (amavisd-new,\r
26         port 10024) with ESMTP id nicTAqAV5sf1 for <notmuch@notmuchmail.org>;\r
27         Tue, 13 Apr 2010 18:37:57 +0200 (CEST)\r
28 Received: by sam.mediasupervision.de (Postfix, from userid 1000)\r
29         id 60C54485DE6; Tue, 13 Apr 2010 18:37:57 +0200 (CEST)\r
30 Content-Type: text/plain; charset=UTF-8\r
31 Subject: [PATCH] First tests for JSON output and UTF-8 in mail body and\r
32  subject\r
33 From: Gregor Hoffleit <gregor@hoffleit.de>\r
34 To: notmuch <notmuch@notmuchmail.org>\r
35 In-reply-to: <87r5mje55l.fsf@yoom.home.cworth.org>\r
36 References: <1267697893-sup-4538@sam.mediasupervision.de>\r
37         <87r5mje55l.fsf@yoom.home.cworth.org>\r
38 Date: Tue, 13 Apr 2010 18:37:57 +0200\r
39 Message-Id: <1271176622-sup-4680@sam.mediasupervision.de>\r
40 User-Agent: Sup/git\r
41 Content-Transfer-Encoding: 8bit\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.13\r
44 Precedence: list\r
45 List-Id: "Use and development of the notmuch mail system."\r
46         <notmuch.notmuchmail.org>\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
50 List-Post: <mailto:notmuch@notmuchmail.org>\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
54 X-List-Received-Date: Tue, 13 Apr 2010 16:37:58 -0000\r
55 \r
56 The test suite doesn't yet cover --format=json output nor UTF-8 in\r
57 subject or body.\r
58 \r
59 This patch starts with test cases for 'search --format=json' and\r
60 'show --format=json'.\r
61 \r
62 Furthermore, it has test cases for a search for a UTF-8 string in a mail\r
63 body for a UTF-8 string in a mail subject.\r
64 \r
65 Finally, it has a test case for --format=json with UTF-8 messages,\r
66 demonstrating the fix in 1267697893-sup-4538@sam.mediasupervision.de.\r
67 ---\r
68  test/notmuch-test |   38 ++++++++++++++++++++++++++++++++++++++\r
69  1 files changed, 38 insertions(+), 0 deletions(-)\r
70 \r
71 diff --git a/test/notmuch-test b/test/notmuch-test\r
72 index 1c5191b..b2a0756 100755\r
73 --- a/test/notmuch-test\r
74 +++ b/test/notmuch-test\r
75 @@ -146,7 +146,7 @@ add_message ()\r
76  }\r
77  \r
78  NOTMUCH_IGNORED_OUTPUT_REGEXP='^Processed [0-9]*( total)? file|Found [0-9]* total file'\r
79 -NOTMUCH_THREAD_ID_SQUELCH='s/thread:................/thread:XXX/'\r
80 +NOTMUCH_THREAD_ID_SQUELCH='s/thread:................/thread:XXX/;s/"thread": "................",/"thread": "XXX",/'\r
81  execute_expecting ()\r
82  {\r
83      args=$1\r
84 @@ -348,6 +348,42 @@ add_message '[subject]="body search (phrase)"' '[date]="Sat, 01 Jan 2000 12:00:0\r
85  add_message '[subject]="negative result"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="This phrase should not match the body search"'\r
86  execute_expecting "search '\"body search (phrase)\"'" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body search (phrase) (inbox unread)"\r
87  \r
88 +printf " Show message: json...\t\t"\r
89 +add_message '[subject]="json-show-subject"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="json-show-message"'\r
90 +execute_expecting "show --format=json 'json-show-message'" '[[[{"id": "'${gen_msg_id}'", "match": true, "filename": "'${gen_msg_filename}'", "date_unix": 946728000, "date_relative": "2000-01-01", "tags": ["inbox","unread"], "headers": {"Subject": "json-show-subject", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "To": "Notmuch Test Suite <test_suite@notmuchmail.org>", "Cc": "", "Bcc": "", "Date": "Sat, 01 Jan 2000 12:00:00 -0000"}, "body": [{"id": 1, "content-type": "text/plain", "content": "json-show-message\n"}]}, []]]]'\r
91 +\r
92 +printf " Search message: json...\t"\r
93 +add_message '[subject]="json-search-subject"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="json-search-message"'\r
94 +execute_expecting "search --format=json 'json-search-message'" '[{"thread": "XXX",\r
95 +"timestamp": 946724400,\r
96 +"matched": 1,\r
97 +"total": 1,\r
98 +"authors": "Notmuch Test Suite",\r
99 +"subject": "json-search-subject",\r
100 +"tags": ["inbox", "unread"]}]'\r
101 +\r
102 +printf " Search by subject (utf-8):...\t"\r
103 +add_message [subject]=utf8-sübjéct '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'\r
104 +execute_expecting "search subject:utf8-sübjéct" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; utf8-sübjéct (inbox unread)"\r
105 +\r
106 +printf " Search body (utf-8):...\t"\r
107 +add_message '[subject]="utf8-message-body-subject"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="message body utf8: bödý"'\r
108 +execute_expecting "search 'bödý'" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; utf8-message-body-subject (inbox unread)"\r
109 +\r
110 +printf " Show message: json, utf-8...\t"\r
111 +add_message '[subject]="json-show-utf8-body-sübjéct"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="jsön-show-méssage"'\r
112 +execute_expecting "show --format=json 'jsön-show-méssage'" '[[[{"id": "'${gen_msg_id}'", "match": true, "filename": "'${gen_msg_filename}'", "date_unix": 946728000, "date_relative": "2000-01-01", "tags": ["inbox","unread"], "headers": {"Subject": "json-show-utf8-body-sübjéct", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "To": "Notmuch Test Suite <test_suite@notmuchmail.org>", "Cc": "", "Bcc": "", "Date": "Sat, 01 Jan 2000 12:00:00 -0000"}, "body": [{"id": 1, "content-type": "text/plain", "content": "jsön-show-méssage\n"}]}, []]]]'\r
113 +\r
114 +printf " Search message: json, utf-8...\t"\r
115 +add_message '[subject]="json-search-utf8-body-sübjéct"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="jsön-search-méssage"'\r
116 +execute_expecting "search --format=json 'jsön-search-méssage'" '[{"thread": "XXX",\r
117 +"timestamp": 946724400,\r
118 +"matched": 1,\r
119 +"total": 1,\r
120 +"authors": "Notmuch Test Suite",\r
121 +"subject": "json-search-utf8-body-sübjéct",\r
122 +"tags": ["inbox", "unread"]}]'\r
123 +\r
124  printf " Search by from: (address)...\t"\r
125  add_message '[subject]="search by from (address)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [from]=searchbyfrom@example.com\r
126  execute_expecting "search from:searchbyfrom@example.com" "thread:XXX   2000-01-01 [1/1] searchbyfrom@example.com; search by from (address) (inbox unread)"\r