Re: Hi all
[notmuch-archives.git] / 1a / 46e8b122d7d2b660ed288cf9b6106b00934ddd
1 Return-Path: <amdragon@mit.edu>\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 3835B431FBC\r
6         for <notmuch@notmuchmail.org>; Fri, 27 Jul 2012 21:29:30 -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.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 Go851ytBFD6k for <notmuch@notmuchmail.org>;\r
16         Fri, 27 Jul 2012 21:29:28 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU\r
18         [18.7.68.36])\r
19         by olra.theworths.org (Postfix) with ESMTP id D2450431FBF\r
20         for <notmuch@notmuchmail.org>; Fri, 27 Jul 2012 21:29:25 -0700 (PDT)\r
21 X-AuditID: 12074424-b7f2a6d0000008bf-a3-50136aa4c8b0\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id D3.1B.02239.4AA63105; Sat, 28 Jul 2012 00:29:24 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q6S4TNoH012931; \r
27         Sat, 28 Jul 2012 00:29:23 -0400\r
28 Received: from drake.dyndns.org\r
29         (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [209.6.116.242]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6S4TKXT027353\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sat, 28 Jul 2012 00:29:21 -0400 (EDT)\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
36         (envelope-from <amdragon@mit.edu>)\r
37         id 1SuyeW-0002Wn-BK; Sat, 28 Jul 2012 00:29:20 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH v2 02/13] test: Remove unnecessary JSON canonicalization\r
41 Date: Sat, 28 Jul 2012 00:29:03 -0400\r
42 Message-Id: <1343449754-9010-3-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10\r
44 In-Reply-To: <1343449754-9010-1-git-send-email-amdragon@mit.edu>\r
45 References: <1343449754-9010-1-git-send-email-amdragon@mit.edu>\r
46 MIME-Version: 1.0\r
47 Content-Type: text/plain; charset=UTF-8\r
48 Content-Transfer-Encoding: 8bit\r
49 X-Brightmail-Tracker:\r
50  H4sIAAAAAAAAA+NgFprGKsWRmVeSWpSXmKPExsUixG6nrrskSzjAYEKrosXehnZGi9VzeSyu\r
51         35zJbPFm5TxWBxaPnbPusnss3rSfzePw14UsHs9W3WIOYInisklJzcksSy3St0vgyjhz7CtL\r
52         wVeXih1vJjM3ML627mLk5JAQMJHoP7+CDcIWk7hwbz2QzcUhJLCPUaL17AZmCGcDo8TP87uh\r
53         Mo+YJGa9WwaVmcsosefeTRaQfjYBDYlt+5czgtgiAtISO+/OZu1i5OBgFsiTeLxWAiQsLJAh\r
54         sWTqA2YQm0VAVeLCMohWXgF7idvb30KdIS/x9H4fmM0p4CCx+eUHsHohoJrdkzewQtQLSpyc\r
55         +YQFYry6xPp5QiBhZqDW5q2zmScwCs1CUjULoWoWkqoFjMyrGGVTcqt0cxMzc4pTk3WLkxPz\r
56         8lKLdM31cjNL9FJTSjcxgoPfRWUHY/MhpUOMAhyMSjy8p64IBQixJpYVV+YeYpTkYFIS5Y0K\r
57         Fw4Q4kvKT6nMSCzOiC8qzUktPsQowcGsJMK7UxAox5uSWFmVWpQPk5LmYFES572ectNfSCA9\r
58         sSQ1OzW1ILUIJivDwaEkwbs9E6hRsCg1PbUiLTOnBCHNxMEJMpwHaPgakBre4oLE3OLMdIj8\r
59         KUZFKXHexyAJAZBERmkeXC8sOb1iFAd6RZj3GkgVDzCxwXW/AhrMBDTYIloIZHBJIkJKqoFR\r
60         yVnK5kq8u6X+/crS3stvhLZ+WPL0+p/S65d360/atOmG3dzQzf3mcyVNEuJZ/0tMCjdLfVZ9\r
61         Tz1yqeG54txTT81mTHCvXSGQv09tK/vk936nvX6k7s+v87KqFVneV36w7d8F8bPHZA13LEiS\r
62         qLr1IGCK0wyxyNxlW2+u9l2m6sURGm4i0c2oxFKckWioxVxUnAgALkwjeCkDAAA=\r
63 Cc: tomi.ollila@iki.fi\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68         <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Sat, 28 Jul 2012 04:29:30 -0000\r
77 \r
78 Format canonicalization of JSON output is no longer necessary, so\r
79 remove it.  Value canonicalization (e.g., normalizing thread IDs) is\r
80 still necessary, so all of the sanitization functions remain.\r
81 ---\r
82  test/json         |    4 ++--\r
83  test/maildir-sync |    1 -\r
84  test/multipart    |   40 ++++++++++------------------------------\r
85  3 files changed, 12 insertions(+), 33 deletions(-)\r
86 \r
87 diff --git a/test/json b/test/json\r
88 index d86ee46..ac8fa8e 100755\r
89 --- a/test/json\r
90 +++ b/test/json\r
91 @@ -18,7 +18,7 @@ test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true\r
92  \r
93  test_begin_subtest "Search message: json"\r
94  add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-search-message\""\r
95 -output=$(notmuch search --format=json "json-search-message" | notmuch_json_show_sanitize | notmuch_search_sanitize)\r
96 +output=$(notmuch search --format=json "json-search-message" | notmuch_search_sanitize)\r
97  test_expect_equal_json "$output" "[{\"thread\": \"XXX\",\r
98   \"timestamp\": 946728000,\r
99   \"date_relative\": \"2000-01-01\",\r
100 @@ -49,7 +49,7 @@ test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"exclud\r
101  \r
102  test_begin_subtest "Search message: json, utf-8"\r
103  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
104 -output=$(notmuch search --format=json "jsön-search-méssage" | notmuch_json_show_sanitize | notmuch_search_sanitize)\r
105 +output=$(notmuch search --format=json "jsön-search-méssage" | notmuch_search_sanitize)\r
106  test_expect_equal_json "$output" "[{\"thread\": \"XXX\",\r
107   \"timestamp\": 946728000,\r
108   \"date_relative\": \"2000-01-01\",\r
109 diff --git a/test/maildir-sync b/test/maildir-sync\r
110 index b748d04..cd7d241 100755\r
111 --- a/test/maildir-sync\r
112 +++ b/test/maildir-sync\r
113 @@ -7,7 +7,6 @@ test_description="maildir synchronization"\r
114  # Avoid including the local value of MAIL_DIR in the result.\r
115  filter_show_json() {\r
116      sed -e "s|${MAIL_DIR}/|MAIL_DIR/|"\r
117 -    echo\r
118  }\r
119  \r
120  # Create the expected maildir structure\r
121 diff --git a/test/multipart b/test/multipart\r
122 index 3ccf27f..0527f84 100755\r
123 --- a/test/multipart\r
124 +++ b/test/multipart\r
125 @@ -319,10 +319,8 @@ test_expect_success \\r
126      "notmuch show --format=text --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'"\r
127  \r
128  test_begin_subtest "--format=json --part=0, full message"\r
129 -notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
130 -echo >>OUTPUT # expect *no* newline at end of output\r
131 +notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
132  cat <<EOF >EXPECTED\r
133 -\r
134  {"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "excluded": false, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [\r
135  {"id": 1, "content-type": "multipart/signed", "content": [\r
136  {"id": 2, "content-type": "multipart/mixed", "content": [\r
137 @@ -337,10 +335,8 @@ EOF\r
138  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
139  \r
140  test_begin_subtest "--format=json --part=1, message body"\r
141 -notmuch show --format=json --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
142 -echo >>OUTPUT # expect *no* newline at end of output\r
143 +notmuch show --format=json --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
144  cat <<EOF >EXPECTED\r
145 -\r
146  {"id": 1, "content-type": "multipart/signed", "content": [\r
147  {"id": 2, "content-type": "multipart/mixed", "content": [\r
148  {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [\r
149 @@ -354,10 +350,8 @@ EOF\r
150  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
151  \r
152  test_begin_subtest "--format=json --part=2, multipart/mixed"\r
153 -notmuch show --format=json --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
154 -echo >>OUTPUT # expect *no* newline at end of output\r
155 +notmuch show --format=json --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
156  cat <<EOF >EXPECTED\r
157 -\r
158  {"id": 2, "content-type": "multipart/mixed", "content": [\r
159  {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [\r
160  {"id": 4, "content-type": "multipart/alternative", "content": [\r
161 @@ -369,10 +363,8 @@ EOF\r
162  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
163  \r
164  test_begin_subtest "--format=json --part=3, rfc822 part"\r
165 -notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
166 -echo >>OUTPUT # expect *no* newline at end of output\r
167 +notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
168  cat <<EOF >EXPECTED\r
169 -\r
170  {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [\r
171  {"id": 4, "content-type": "multipart/alternative", "content": [\r
172  {"id": 5, "content-type": "text/html"}, \r
173 @@ -381,10 +373,8 @@ EOF\r
174  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
175  \r
176  test_begin_subtest "--format=json --part=4, rfc822's multipart/alternative"\r
177 -notmuch show --format=json --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
178 -echo >>OUTPUT # expect *no* newline at end of output\r
179 +notmuch show --format=json --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
180  cat <<EOF >EXPECTED\r
181 -\r
182  {"id": 4, "content-type": "multipart/alternative", "content": [\r
183  {"id": 5, "content-type": "text/html"}, \r
184  {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}\r
185 @@ -392,46 +382,36 @@ EOF\r
186  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
187  \r
188  test_begin_subtest "--format=json --part=5, rfc822's html part"\r
189 -notmuch show --format=json --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
190 -echo >>OUTPUT # expect *no* newline at end of output\r
191 +notmuch show --format=json --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
192  cat <<EOF >EXPECTED\r
193 -\r
194  {"id": 5, "content-type": "text/html"}\r
195  EOF\r
196  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
197  \r
198  test_begin_subtest "--format=json --part=6, rfc822's text part"\r
199 -notmuch show --format=json --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
200 -echo >>OUTPUT # expect *no* newline at end of output\r
201 +notmuch show --format=json --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
202  cat <<EOF >EXPECTED\r
203 -\r
204  {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}\r
205  EOF\r
206  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
207  \r
208  test_begin_subtest "--format=json --part=7, inline attachment"\r
209 -notmuch show --format=json --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
210 -echo >>OUTPUT # expect *no* newline at end of output\r
211 +notmuch show --format=json --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
212  cat <<EOF >EXPECTED\r
213 -\r
214  {"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}\r
215  EOF\r
216  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
217  \r
218  test_begin_subtest "--format=json --part=8, plain text part"\r
219 -notmuch show --format=json --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
220 -echo >>OUTPUT # expect *no* newline at end of output\r
221 +notmuch show --format=json --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
222  cat <<EOF >EXPECTED\r
223 -\r
224  {"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}\r
225  EOF\r
226  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
227  \r
228  test_begin_subtest "--format=json --part=9, pgp signature (unverified)"\r
229 -notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
230 -echo >>OUTPUT # expect *no* newline at end of output\r
231 +notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
232  cat <<EOF >EXPECTED\r
233 -\r
234  {"id": 9, "content-type": "application/pgp-signature"}\r
235  EOF\r
236  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
237 -- \r
238 1.7.10\r
239 \r