1 Return-Path: <jrollins@servo.finestructure.net>
\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 EF5F0431FD0
\r
6 for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:32 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5
\r
12 tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3]
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id E6P+29JBH+I4 for <notmuch@notmuchmail.org>;
\r
17 Sat, 28 May 2011 14:52:30 -0700 (PDT)
\r
18 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu
\r
20 by olra.theworths.org (Postfix) with ESMTP id D860E429E41
\r
21 for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:17 -0700 (PDT)
\r
22 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])
\r
23 by fire-doxen-postvirus (Postfix) with ESMTP id 61EF82E50EC1;
\r
24 Sat, 28 May 2011 14:45:50 -0700 (PDT)
\r
25 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new
\r
26 Received: from servo.finestructure.net (cpe-98-149-172-122.socal.res.rr.com
\r
27 [98.149.172.122]) (Authenticated sender: jrollins)
\r
28 by fire-doxen-submit (Postfix) with ESMTP id DF9822E50F67;
\r
29 Sat, 28 May 2011 14:45:46 -0700 (PDT)
\r
30 Received: by servo.finestructure.net (Postfix, from userid 1000)
\r
31 id 5E58492B; Sat, 28 May 2011 14:52:05 -0700 (PDT)
\r
32 From: Jameson Graef Rollins <jrollins@finestructure.net>
\r
33 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
34 Subject: [PATCH 23/25] test: update emacs test to use test_expect_equal_file
\r
35 Date: Sat, 28 May 2011 14:51:58 -0700
\r
36 Message-Id: <1306619520-25730-24-git-send-email-jrollins@finestructure.net>
\r
37 X-Mailer: git-send-email 1.7.4.4
\r
38 In-Reply-To: <1306619520-25730-23-git-send-email-jrollins@finestructure.net>
\r
39 References: <1306619520-25730-1-git-send-email-jrollins@finestructure.net>
\r
40 <1306619520-25730-2-git-send-email-jrollins@finestructure.net>
\r
41 <1306619520-25730-3-git-send-email-jrollins@finestructure.net>
\r
42 <1306619520-25730-4-git-send-email-jrollins@finestructure.net>
\r
43 <1306619520-25730-5-git-send-email-jrollins@finestructure.net>
\r
44 <1306619520-25730-6-git-send-email-jrollins@finestructure.net>
\r
45 <1306619520-25730-7-git-send-email-jrollins@finestructure.net>
\r
46 <1306619520-25730-8-git-send-email-jrollins@finestructure.net>
\r
47 <1306619520-25730-9-git-send-email-jrollins@finestructure.net>
\r
48 <1306619520-25730-10-git-send-email-jrollins@finestructure.net>
\r
49 <1306619520-25730-11-git-send-email-jrollins@finestructure.net>
\r
50 <1306619520-25730-12-git-send-email-jrollins@finestructure.net>
\r
51 <1306619520-25730-13-git-send-email-jrollins@finestructure.net>
\r
52 <1306619520-25730-14-git-send-email-jrollins@finestructure.net>
\r
53 <1306619520-25730-15-git-send-email-jrollins@finestructure.net>
\r
54 <1306619520-25730-16-git-send-email-jrollins@finestructure.net>
\r
55 <1306619520-25730-17-git-send-email-jrollins@finestructure.net>
\r
56 <1306619520-25730-18-git-send-email-jrollins@finestructure.net>
\r
57 <1306619520-25730-19-git-send-email-jrollins@finestructure.net>
\r
58 <1306619520-25730-20-git-send-email-jrollins@finestructure.net>
\r
59 <1306619520-25730-21-git-send-email-jrollins@finestructure.net>
\r
60 <1306619520-25730-22-git-send-email-jrollins@finestructure.net>
\r
61 <1306619520-25730-23-git-send-email-jrollins@finestructure.net>
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.13
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Sat, 28 May 2011 21:52:33 -0000
\r
76 This is a much cleaner way to do the emacs tests, since we're actually
\r
77 comparing output against existing files with expected output. We also
\r
78 won't miss any trailing newlines this way.
\r
80 And speaking of which, one of the expected output files was actually
\r
81 missing a trailing blank line that was actually in one of the original
\r
82 messages, so this was fixed.
\r
84 test/emacs | 80 +++++++++----------
\r
85 .../notmuch-show-thread-maildir-storage | 1 +
\r
86 2 files changed, 39 insertions(+), 42 deletions(-)
\r
88 diff --git a/test/emacs b/test/emacs
\r
89 index 042f1cb..f14249e 100755
\r
92 @@ -7,39 +7,33 @@ EXPECTED=../emacs.expected-output
\r
95 test_begin_subtest "Basic notmuch-hello view in emacs"
\r
96 -output=$(test_emacs '(notmuch-hello) (princ (buffer-string))')
\r
97 -expected=$(cat $EXPECTED/notmuch-hello)
\r
98 -test_expect_equal "$output" "$expected"
\r
99 +test_emacs '(notmuch-hello) (princ (buffer-string))' >OUTPUT
\r
100 +test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello
\r
102 test_begin_subtest "Saved search with 0 results"
\r
103 -output=$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))')
\r
104 -expected=$(cat $EXPECTED/notmuch-hello-with-empty)
\r
105 -test_expect_equal "$output" "$expected"
\r
106 +test_emacs '(setq notmuch-show-empty-saved-searches t) (setq notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))' >OUTPUT
\r
107 +test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty
\r
109 test_begin_subtest "No saved searches displayed (all with 0 results)"
\r
110 -output=$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))')
\r
111 -expected=$(cat $EXPECTED/notmuch-hello-no-saved-searches)
\r
112 -test_expect_equal "$output" "$expected"
\r
113 +test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))' >OUTPUT
\r
114 +test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches
\r
116 test_begin_subtest "Basic notmuch-search view in emacs"
\r
117 -output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (princ (buffer-string))')
\r
118 -expected=$(cat $EXPECTED/notmuch-search-tag-inbox)
\r
119 -test_expect_equal "$output" "$expected"
\r
120 +test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (princ (buffer-string))' >OUTPUT
\r
121 +test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox
\r
123 test_begin_subtest "Navigation of notmuch-hello to search results"
\r
124 -output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (princ (buffer-string))')
\r
125 -expected=$(cat $EXPECTED/notmuch-hello-view-inbox)
\r
126 -test_expect_equal "$output" "$expected"
\r
127 +test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (princ (buffer-string))' >OUTPUT
\r
128 +test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox
\r
130 test_begin_subtest "Basic notmuch-show view in emacs"
\r
131 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
\r
132 -output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (princ (buffer-string))")
\r
133 -expected=$(cat $EXPECTED/notmuch-show-thread-maildir-storage)
\r
134 -test_expect_equal "$output" "$expected"
\r
135 +test_emacs "(notmuch-show \"$maildir_storage_thread\") (princ (buffer-string))" >OUTPUT
\r
136 +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
\r
138 test_begin_subtest "Navigation of notmuch-search to thread view"
\r
139 -output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))')
\r
140 -test_expect_equal "$output" "$expected"
\r
141 +test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))' >OUTPUT
\r
142 +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
\r
144 test_begin_subtest "Add tag from search view"
\r
145 os_x_darwin_thread=$(notmuch search --output=threads id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com)
\r
146 @@ -80,10 +74,11 @@ smtp_dummy_pid=$!
\r
147 test_emacs "(setq message-send-mail-function 'message-smtpmail-send-it) (setq smtpmail-smtp-server \"localhost\") (setq smtpmail-smtp-service \"25025\") (notmuch-hello) (notmuch-mua-mail) (message-goto-to) (insert \"user@example.com\nDate: Fri, 29 Mar 1974 10:00:00 -0000\") (message-goto-subject) (insert \"Testing message sent via SMTP\") (message-goto-body) (insert \"This is a test that messages are sent via SMTP\") (message-send-and-exit)" >/dev/null 2>&1
\r
148 wait ${smtp_dummy_pid}
\r
152 -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' \
\r
153 - -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' < sent_message)
\r
154 -test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
155 + -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' < sent_message >OUTPUT
\r
156 +cat <<EOF >EXPECTED
\r
157 +From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
158 To: user@example.com
\r
159 Subject: Testing message sent via SMTP
\r
160 Date: Fri, 29 Mar 1974 10:00:00 -0000
\r
161 @@ -92,7 +87,9 @@ Message-ID: <XXX>
\r
163 Content-Type: text/plain; charset=us-ascii
\r
165 -This is a test that messages are sent via SMTP"
\r
166 +This is a test that messages are sent via SMTP
\r
168 +test_expect_equal_file OUTPUT EXPECTED
\r
170 test_begin_subtest "Verify that sent messages are saved/searchable (via FCC)"
\r
171 notmuch new > /dev/null
\r
172 @@ -102,37 +99,36 @@ test_expect_equal "$output" "thread:XXX 1974-03-29 [1/1] Notmuch Test Suite; T
\r
173 test_begin_subtest "Reply within emacs"
\r
174 # We sed away everything before the ^From in the output to avoid getting
\r
175 # confused by messages such as "Parsing /home/cworth/.mailrc... done"
\r
176 -output=$(test_emacs '(notmuch-search "subject:\"testing message sent via SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) (princ (buffer-string))' | sed -ne '/^From/,$ p' | sed -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/')
\r
177 -test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
178 +test_emacs '(notmuch-search "subject:\"testing message sent via SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) (princ (buffer-string))' | sed -ne '/^From/,$ p' | sed -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' >OUTPUT
\r
179 +cat <<EOF >EXPECTED
\r
180 +From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
181 To: user@example.com
\r
182 Subject: Re: Testing message sent via SMTP
\r
184 Fcc: $(pwd)/mail/sent
\r
185 --text follows this line--
\r
186 On Fri, 29 Mar 1974 10:00:00 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
\r
187 -> This is a test that messages are sent via SMTP"
\r
188 +> This is a test that messages are sent via SMTP
\r
190 +test_expect_equal_file OUTPUT EXPECTED
\r
192 test_begin_subtest "Save attachment from within emacs"
\r
193 echo "./attachment" | test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com") (notmuch-show-save-attachments)' > /dev/null 2>&1
\r
194 -output=$(cat attachment)
\r
195 -expected=$(cat $EXPECTED/attachment)
\r
196 -test_expect_equal "$output" "$expected"
\r
197 +test_expect_equal_file attachment $EXPECTED/attachment
\r
199 test_begin_subtest "View raw message within emacs"
\r
200 -expected=$(cat $EXPECTED/raw-message-cf0c4d-52ad0a)
\r
201 -first_line=$(echo "$expected" | head -n1)
\r
202 -output=$(test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com") (notmuch-show-view-raw-message) (princ (buffer-string))' | sed -ne "/$first_line/,\$ p")
\r
203 -test_expect_equal "$output" "$expected"
\r
204 +first_line=$(head -n1 $EXPECTED/raw-message-cf0c4d-52ad0a)
\r
205 +test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com") (notmuch-show-view-raw-message) (princ (buffer-string))' | sed -ne "/$first_line/,\$ p" >OUTPUT
\r
206 +test_expect_equal_file OUTPUT $EXPECTED/raw-message-cf0c4d-52ad0a
\r
208 test_begin_subtest "Hiding/showing signature in notmuch-show view"
\r
209 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
\r
210 -output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\")
\r
211 - (search-forward \"Click/Enter to show.\")
\r
212 - (button-activate (button-at (point)))
\r
213 - (search-backward \"Click/Enter to hide.\")
\r
214 - (button-activate (button-at (point)))
\r
215 - (princ (buffer-string))")
\r
216 -expected=$(cat $EXPECTED/notmuch-show-thread-maildir-storage)
\r
217 -test_expect_equal "$output" "$expected"
\r
218 +test_emacs "(notmuch-show \"$maildir_storage_thread\")
\r
219 + (search-forward \"Click/Enter to show.\")
\r
220 + (button-activate (button-at (point)))
\r
221 + (search-backward \"Click/Enter to hide.\")
\r
222 + (button-activate (button-at (point)))
\r
223 + (princ (buffer-string))" >OUTPUT
\r
224 +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
\r
227 diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage b/test/emacs.expected-output/notmuch-show-thread-maildir-storage
\r
228 index 241b5b7..8ba64b2 100644
\r
229 --- a/test/emacs.expected-output/notmuch-show-thread-maildir-storage
\r
230 +++ b/test/emacs.expected-output/notmuch-show-thread-maildir-storage
\r
231 @@ -212,3 +212,4 @@ http://notmuchmail.org/mailman/listinfo/notmuch
\r