1 Return-Path: <bremner@tesseract.cs.unb.ca>
\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 7564F431FDF
\r
6 for <notmuch@notmuchmail.org>; Mon, 9 Dec 2013 05:37:41 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 Oy1IQJYaguN0 for <notmuch@notmuchmail.org>;
\r
16 Mon, 9 Dec 2013 05:37:37 -0800 (PST)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 950C1431FBC
\r
21 for <notmuch@notmuchmail.org>; Mon, 9 Dec 2013 05:37:37 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
24 id 1Vq11l-0003FF-A4; Mon, 09 Dec 2013 09:37:37 -0400
\r
25 Received: (nullmailer pid 27762 invoked by uid 1000); Mon, 09 Dec 2013
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [Patch v2 3/4] test: sanitize dates in emacs, raw, and text output
\r
30 Date: Mon, 9 Dec 2013 21:36:30 +0800
\r
31 Message-Id: <1386596191-27683-3-git-send-email-david@tethera.net>
\r
32 X-Mailer: git-send-email 1.8.4.3
\r
33 In-Reply-To: <1386596191-27683-1-git-send-email-david@tethera.net>
\r
34 References: <1386517946-22054-1-git-send-email-david@tethera.net>
\r
35 <1386596191-27683-1-git-send-email-david@tethera.net>
\r
37 Content-Type: text/plain; charset=UTF-8
\r
38 Content-Transfer-Encoding: 8bit
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Mon, 09 Dec 2013 13:37:41 -0000
\r
53 add a new function notmuch_date_sanitize for rfc822-ish things. Add
\r
54 date sanitization to notmuch_show_sanitize_all and use it more places.
\r
56 This is all in aid of a transition to unique timestamps on messages.
\r
58 test/emacs | 12 +++++++-----
\r
59 test/emacs-show | 10 ++++++----
\r
60 test/encoding | 8 ++++----
\r
61 test/raw | 8 ++++----
\r
62 test/test-lib.sh | 9 ++++++++-
\r
63 5 files changed, 29 insertions(+), 18 deletions(-)
\r
65 diff --git a/test/emacs b/test/emacs
\r
66 index 456435c..1b1ebe3 100755
\r
69 @@ -86,15 +86,16 @@ add_message "[subject]=\"message-with-invalid-from\"" \
\r
70 "[from]=\"\\\"Invalid \\\" From\\\" <test_suite@notmuchmail.org>\""
\r
71 thread=$(notmuch search --output=threads subject:message-with-invalid-from)
\r
72 test_emacs "(notmuch-show \"$thread\")
\r
74 + (test-output \"OUTPUT.raw\")"
\r
76 "Invalid " (2001-01-05) (inbox)
\r
77 Subject: message-with-invalid-from
\r
78 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
79 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
80 +Date: GENERATED_DATE
\r
82 This is just a test message (#1)
\r
84 +notmuch_date_sanitize < OUTPUT.raw > OUTPUT
\r
85 test_expect_equal_file OUTPUT EXPECTED
\r
87 test_begin_subtest "Navigation of notmuch-search to thread view"
\r
88 @@ -605,11 +606,11 @@ Q: Why is top-posting such a bad thing?
\r
90 Q: What is the most annoying thing in e-mail?"'
\r
91 test_emacs "(notmuch-show \"top-posting\")
\r
92 - (test-visible-output)"
\r
93 + (test-visible-output \"OUTPUT.raw\")"
\r
94 echo "Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
\r
95 Subject: The problem with top-posting
\r
96 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
97 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
98 +Date: GENERATED_DATE
\r
100 A: Because it messes up the order in which people normally read text.
\r
101 Q: Why is top-posting such a bad thing?
\r
102 @@ -618,13 +619,14 @@ Q: What is the most annoying thing in e-mail?
\r
103 Top Poster <top@poster.com> (2001-01-05) (inbox unread)
\r
104 Subject: Re: The problem with top-posting
\r
105 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
106 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
107 +Date: GENERATED_DATE
\r
109 Thanks for the advice! I will be sure to put it to good use.
\r
113 [ 9-line hidden original message. Click/Enter to show. ]" > EXPECTED
\r
114 +notmuch_date_sanitize < OUTPUT.raw > OUTPUT
\r
115 test_expect_equal_file OUTPUT EXPECTED
\r
117 test_begin_subtest "Hiding message in notmuch-show view"
\r
118 diff --git a/test/emacs-show b/test/emacs-show
\r
119 index ec86333..2a3a535 100755
\r
120 --- a/test/emacs-show
\r
121 +++ b/test/emacs-show
\r
122 @@ -19,13 +19,14 @@ cat <<EOF >EXPECTED
\r
123 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
\r
124 Subject: Hiding Original Message region at beginning of a message
\r
125 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
126 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
127 +Date: GENERATED_DATE
\r
129 [ 2-line hidden original message. Click/Enter to show. ]
\r
132 test_emacs "(notmuch-show \"id:$message_id\")
\r
133 - (test-visible-output)"
\r
134 + (test-visible-output \"OUTPUT.raw\")"
\r
135 +notmuch_date_sanitize < OUTPUT.raw > OUTPUT
\r
136 test_expect_equal_file OUTPUT EXPECTED
\r
138 test_begin_subtest "Bare subject #1"
\r
139 @@ -130,12 +131,12 @@ mid:abc%20def
\r
140 mid:abc. mid:abc, mid:abc;"'
\r
141 test_emacs '(notmuch-show "id:'$gen_msg_id'")
\r
142 (notmuch-test-mark-links)
\r
143 - (test-visible-output)'
\r
144 + (test-visible-output "OUTPUT.raw")'
\r
145 cat <<EOF >EXPECTED
\r
146 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
\r
147 Subject: id buttonization
\r
148 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
149 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
150 +Date: GENERATED_DATE
\r
153 <<id:abc.def>>. <<id:abc,def>>, <<id:abc;def>>; <<id:abc:def>>:
\r
154 @@ -159,6 +160,7 @@ cid:xxx
\r
156 <<mid:abc>>. <<mid:abc>>, <<mid:abc>>;
\r
158 +notmuch_date_sanitize < OUTPUT.raw > OUTPUT
\r
159 test_expect_equal_file OUTPUT EXPECTED
\r
162 diff --git a/test/encoding b/test/encoding
\r
163 index 8609652..b6c86bf 100755
\r
164 --- a/test/encoding
\r
165 +++ b/test/encoding
\r
166 @@ -5,14 +5,14 @@ test_description="encoding issues"
\r
167 test_begin_subtest "Message with text of unknown charset"
\r
168 add_message '[content-type]="text/plain; charset=unknown-8bit"' \
\r
169 "[body]=irrelevant"
\r
170 -output=$(notmuch show id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
\r
171 -test_expect_equal "$output" "
\f\r
172 message{ id:msg-001@notmuch-test-suite depth:0 match:1 excluded:0 filename:/XXX/mail/msg-001
\r
173 +output=$(notmuch show id:${gen_msg_id} 2>&1 | notmuch_show_sanitize_all)
\r
174 +test_expect_equal "$output" "
\f\r
175 message{ id:XXXXX depth:0 match:1 excluded:0 filename:XXXXX
\r
178 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox unread)
\r
179 Subject: Message with text of unknown charset
\r
180 From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
181 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
182 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
183 +Date: GENERATED_DATE
\r
189 part{ ID: 1, Content-type: text/plain
\r
190 @@ -26,7 +26,7 @@ add_message '[content-type]="text/plain; charset=iso-8859-2"' \
\r
191 '[content-transfer-encoding]=8bit' \
\r
192 '[subject]="ISO-8859-2 encoded message"' \
\r
193 "[body]=$'Czech word tu\350\362\341\350\350\355 means pinguin\'s.'" # ISO-8859-2 characters are generated by shell's escape sequences
\r
194 -output=$(notmuch search tučňáččí 2>&1 | notmuch_show_sanitize)
\r
195 +output=$(notmuch search tučňáččí 2>&1 | notmuch_show_sanitize_all)
\r
196 test_expect_equal "$output" "thread:0000000000000002 2001-01-05 [1/1] Notmuch Test Suite; ISO-8859-2 encoded message (inbox unread)"
\r
198 test_begin_subtest "RFC 2047 encoded word with spaces"
\r
199 diff --git a/test/raw b/test/raw
\r
200 index de0b867..daf5735 100755
\r
203 @@ -11,22 +11,22 @@ output=$(notmuch show --format=raw "*" 2>&1)
\r
204 test_expect_equal "$output" "Error: search term did not match precisely one message."
\r
206 test_begin_subtest "Show a raw message"
\r
207 -output=$(notmuch show --format=raw id:msg-001@notmuch-test-suite)
\r
208 +output=$(notmuch show --format=raw id:msg-001@notmuch-test-suite | notmuch_date_sanitize)
\r
209 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
210 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
211 Message-Id: <msg-001@notmuch-test-suite>
\r
212 Subject: Test message #1
\r
213 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
214 +Date: GENERATED_DATE
\r
216 This is just a test message (#1)"
\r
218 test_begin_subtest "Show another raw message"
\r
219 -output=$(notmuch show --format=raw id:msg-002@notmuch-test-suite)
\r
220 +output=$(notmuch show --format=raw id:msg-002@notmuch-test-suite | notmuch_date_sanitize)
\r
221 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
222 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
223 Message-Id: <msg-002@notmuch-test-suite>
\r
224 Subject: Test message #2
\r
225 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
226 +Date: GENERATED_DATE
\r
228 This is just a test message (#2)"
\r
230 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
231 index 8f18e73..d22408d 100644
\r
232 --- a/test/test-lib.sh
\r
233 +++ b/test/test-lib.sh
\r
234 @@ -618,7 +618,8 @@ notmuch_show_sanitize_all ()
\r
237 -e 's| filename:.*| filename:XXXXX|' \
\r
238 - -e 's| id:[^ ]* | id:XXXXX |'
\r
239 + -e 's| id:[^ ]* | id:XXXXX |' | \
\r
240 + notmuch_date_sanitize
\r
243 notmuch_json_show_sanitize ()
\r
244 @@ -641,6 +642,12 @@ notmuch_emacs_error_sanitize ()
\r
245 -e 's/^\[.*\]$/[XXX]/' \
\r
246 -e "s|^\(command: \)\{0,1\}/.*/$command|\1YYY/$command|"
\r
249 +notmuch_date_sanitize ()
\r
252 + -e 's/^Date: Fri, 05 Jan 2001 .*0000/Date: GENERATED_DATE/'
\r
254 # End of notmuch helper functions
\r
256 # Use test_set_prereq to tell that a particular prerequisite is available.
\r