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 1D098431E62
\r
6 for <notmuch@notmuchmail.org>; Sun, 8 Dec 2013 07:53:10 -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 Y5-EOqazru8s for <notmuch@notmuchmail.org>;
\r
16 Sun, 8 Dec 2013 07:53:04 -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 22398431E64
\r
21 for <notmuch@notmuchmail.org>; Sun, 8 Dec 2013 07:52:55 -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 1Vpgf8-0006AO-QH; Sun, 08 Dec 2013 11:52:54 -0400
\r
25 Received: (nullmailer pid 22782 invoked by uid 1000); Sun, 08 Dec 2013
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [PATCH 3/4] test: sanitize dates in emacs, raw, and text output
\r
30 Date: Sun, 8 Dec 2013 23:52:25 +0800
\r
31 Message-Id: <1386517946-22054-4-git-send-email-david@tethera.net>
\r
32 X-Mailer: git-send-email 1.8.4.3
\r
33 In-Reply-To: <1386517946-22054-1-git-send-email-david@tethera.net>
\r
34 References: <1386517946-22054-1-git-send-email-david@tethera.net>
\r
36 Content-Type: text/plain; charset=UTF-8
\r
37 Content-Transfer-Encoding: 8bit
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Sun, 08 Dec 2013 15:53:10 -0000
\r
52 add a new function notmuch_date_sanitize for rfc822-ish things. Add
\r
53 date sanitization to notmuch_show_sanitize_all and use it more places.
\r
55 This is all in aid of a transition to unique timestamps on messages.
\r
57 test/emacs | 12 +++++++-----
\r
58 test/emacs-show | 10 ++++++----
\r
59 test/encoding | 8 ++++----
\r
60 test/raw | 8 ++++----
\r
61 test/test-lib.sh | 9 ++++++++-
\r
62 5 files changed, 29 insertions(+), 18 deletions(-)
\r
64 diff --git a/test/emacs b/test/emacs
\r
65 index 456435c..1b1ebe3 100755
\r
68 @@ -86,15 +86,16 @@ add_message "[subject]=\"message-with-invalid-from\"" \
\r
69 "[from]=\"\\\"Invalid \\\" From\\\" <test_suite@notmuchmail.org>\""
\r
70 thread=$(notmuch search --output=threads subject:message-with-invalid-from)
\r
71 test_emacs "(notmuch-show \"$thread\")
\r
73 + (test-output \"OUTPUT.raw\")"
\r
75 "Invalid " (2001-01-05) (inbox)
\r
76 Subject: message-with-invalid-from
\r
77 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
78 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
79 +Date: GENERATED_DATE
\r
81 This is just a test message (#1)
\r
83 +notmuch_date_sanitize < OUTPUT.raw > OUTPUT
\r
84 test_expect_equal_file OUTPUT EXPECTED
\r
86 test_begin_subtest "Navigation of notmuch-search to thread view"
\r
87 @@ -605,11 +606,11 @@ Q: Why is top-posting such a bad thing?
\r
89 Q: What is the most annoying thing in e-mail?"'
\r
90 test_emacs "(notmuch-show \"top-posting\")
\r
91 - (test-visible-output)"
\r
92 + (test-visible-output \"OUTPUT.raw\")"
\r
93 echo "Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
\r
94 Subject: The problem with top-posting
\r
95 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
96 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
97 +Date: GENERATED_DATE
\r
99 A: Because it messes up the order in which people normally read text.
\r
100 Q: Why is top-posting such a bad thing?
\r
101 @@ -618,13 +619,14 @@ Q: What is the most annoying thing in e-mail?
\r
102 Top Poster <top@poster.com> (2001-01-05) (inbox unread)
\r
103 Subject: Re: The problem with top-posting
\r
104 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
105 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
106 +Date: GENERATED_DATE
\r
108 Thanks for the advice! I will be sure to put it to good use.
\r
112 [ 9-line hidden original message. Click/Enter to show. ]" > EXPECTED
\r
113 +notmuch_date_sanitize < OUTPUT.raw > OUTPUT
\r
114 test_expect_equal_file OUTPUT EXPECTED
\r
116 test_begin_subtest "Hiding message in notmuch-show view"
\r
117 diff --git a/test/emacs-show b/test/emacs-show
\r
118 index ec86333..2a3a535 100755
\r
119 --- a/test/emacs-show
\r
120 +++ b/test/emacs-show
\r
121 @@ -19,13 +19,14 @@ cat <<EOF >EXPECTED
\r
122 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
\r
123 Subject: Hiding Original Message region at beginning of a message
\r
124 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
125 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
126 +Date: GENERATED_DATE
\r
128 [ 2-line hidden original message. Click/Enter to show. ]
\r
131 test_emacs "(notmuch-show \"id:$message_id\")
\r
132 - (test-visible-output)"
\r
133 + (test-visible-output \"OUTPUT.raw\")"
\r
134 +notmuch_date_sanitize < OUTPUT.raw > OUTPUT
\r
135 test_expect_equal_file OUTPUT EXPECTED
\r
137 test_begin_subtest "Bare subject #1"
\r
138 @@ -130,12 +131,12 @@ mid:abc%20def
\r
139 mid:abc. mid:abc, mid:abc;"'
\r
140 test_emacs '(notmuch-show "id:'$gen_msg_id'")
\r
141 (notmuch-test-mark-links)
\r
142 - (test-visible-output)'
\r
143 + (test-visible-output "OUTPUT.raw")'
\r
144 cat <<EOF >EXPECTED
\r
145 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
\r
146 Subject: id buttonization
\r
147 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
148 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
149 +Date: GENERATED_DATE
\r
152 <<id:abc.def>>. <<id:abc,def>>, <<id:abc;def>>; <<id:abc:def>>:
\r
153 @@ -159,6 +160,7 @@ cid:xxx
\r
155 <<mid:abc>>. <<mid:abc>>, <<mid:abc>>;
\r
157 +notmuch_date_sanitize < OUTPUT.raw > OUTPUT
\r
158 test_expect_equal_file OUTPUT EXPECTED
\r
161 diff --git a/test/encoding b/test/encoding
\r
162 index 8609652..b6c86bf 100755
\r
163 --- a/test/encoding
\r
164 +++ b/test/encoding
\r
165 @@ -5,14 +5,14 @@ test_description="encoding issues"
\r
166 test_begin_subtest "Message with text of unknown charset"
\r
167 add_message '[content-type]="text/plain; charset=unknown-8bit"' \
\r
168 "[body]=irrelevant"
\r
169 -output=$(notmuch show id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
\r
170 -test_expect_equal "$output" "
\f\r
171 message{ id:msg-001@notmuch-test-suite depth:0 match:1 excluded:0 filename:/XXX/mail/msg-001
\r
172 +output=$(notmuch show id:${gen_msg_id} 2>&1 | notmuch_show_sanitize_all)
\r
173 +test_expect_equal "$output" "
\f\r
174 message{ id:XXXXX depth:0 match:1 excluded:0 filename:XXXXX
\r
177 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox unread)
\r
178 Subject: Message with text of unknown charset
\r
179 From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
180 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
181 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
182 +Date: GENERATED_DATE
\r
188 part{ ID: 1, Content-type: text/plain
\r
189 @@ -26,7 +26,7 @@ add_message '[content-type]="text/plain; charset=iso-8859-2"' \
\r
190 '[content-transfer-encoding]=8bit' \
\r
191 '[subject]="ISO-8859-2 encoded message"' \
\r
192 "[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
193 -output=$(notmuch search tučňáččí 2>&1 | notmuch_show_sanitize)
\r
194 +output=$(notmuch search tučňáččí 2>&1 | notmuch_show_sanitize_all)
\r
195 test_expect_equal "$output" "thread:0000000000000002 2001-01-05 [1/1] Notmuch Test Suite; ISO-8859-2 encoded message (inbox unread)"
\r
197 test_begin_subtest "RFC 2047 encoded word with spaces"
\r
198 diff --git a/test/raw b/test/raw
\r
199 index de0b867..daf5735 100755
\r
202 @@ -11,22 +11,22 @@ output=$(notmuch show --format=raw "*" 2>&1)
\r
203 test_expect_equal "$output" "Error: search term did not match precisely one message."
\r
205 test_begin_subtest "Show a raw message"
\r
206 -output=$(notmuch show --format=raw id:msg-001@notmuch-test-suite)
\r
207 +output=$(notmuch show --format=raw id:msg-001@notmuch-test-suite | notmuch_date_sanitize)
\r
208 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
209 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
210 Message-Id: <msg-001@notmuch-test-suite>
\r
211 Subject: Test message #1
\r
212 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
213 +Date: GENERATED_DATE
\r
215 This is just a test message (#1)"
\r
217 test_begin_subtest "Show another raw message"
\r
218 -output=$(notmuch show --format=raw id:msg-002@notmuch-test-suite)
\r
219 +output=$(notmuch show --format=raw id:msg-002@notmuch-test-suite | notmuch_date_sanitize)
\r
220 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
221 To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
222 Message-Id: <msg-002@notmuch-test-suite>
\r
223 Subject: Test message #2
\r
224 -Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
225 +Date: GENERATED_DATE
\r
227 This is just a test message (#2)"
\r
229 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
230 index 9d2f805..d238c66 100644
\r
231 --- a/test/test-lib.sh
\r
232 +++ b/test/test-lib.sh
\r
233 @@ -618,7 +618,8 @@ notmuch_show_sanitize_all ()
\r
236 -e 's| filename:.*| filename:XXXXX|' \
\r
237 - -e 's| id:[^ ]* | id:XXXXX |'
\r
238 + -e 's| id:[^ ]* | id:XXXXX |' \
\r
239 + -e 's|Date: Fri, 05 Jan 2001.*|Date: GENERATED_DATE|'
\r
242 notmuch_json_show_sanitize ()
\r
243 @@ -641,6 +642,12 @@ notmuch_emacs_error_sanitize ()
\r
244 -e 's/^\[.*\]$/[XXX]/' \
\r
245 -e "s|^\(command: \)\{0,1\}/.*/$command|\1YYY/$command|"
\r
248 +notmuch_date_sanitize ()
\r
251 + -e 's/^Date: Fri, 05 Jan 2001 .*/Date: GENERATED_DATE/'
\r
253 # End of notmuch helper functions
\r
255 # Use test_set_prereq to tell that a particular prerequisite is available.
\r