1 Return-Path: <dmitry.kurochkin@gmail.com>
\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 362C8421171
\r
6 for <notmuch@notmuchmail.org>; Mon, 27 Jun 2011 21:45:54 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\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 t+au47icWxr3 for <notmuch@notmuchmail.org>;
\r
17 Mon, 27 Jun 2011 21:45:52 -0700 (PDT)
\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com
\r
19 [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 551AB421164
\r
22 for <notmuch@notmuchmail.org>; Mon, 27 Jun 2011 21:45:46 -0700 (PDT)
\r
23 Received: by mail-bw0-f53.google.com with SMTP id 12so4889638bwg.26
\r
24 for <notmuch@notmuchmail.org>; Mon, 27 Jun 2011 21:45:46 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
26 h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer
\r
27 :in-reply-to:references;
\r
28 bh=ViAC0yiCPc8h0RD+Z5ygFoUeMRd3OtTPtadiKH3EalY=;
\r
29 b=R96eTgt6Ya/35yRrgaGBd/gE9o708qlVS8n3KD8RKXsjr62vin76TZVyNa2UrXNAO/
\r
30 s+nNcU39dvqjsvu5G2lO9NP54TKjkYPtpNGgSFSIAQwH8XyrlIhlNmkP//qsf+8kka0f
\r
31 cVmAQRSFHZieo+xL6Iwnhilo2yelCrGvK1JbU=
\r
32 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
\r
33 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
34 b=hyZP45Uita2oE5mNTwuTbnbIU3vpCzqanobDPGrdGgFjSPl1WXk1IjrgdZjky0IliP
\r
35 6HaqipiS1v+SRm9hF5is3hA+/wxardVX9NGhSmuLp/ZBlDkIu8vlpdXq1ktkcZTK7ZdJ
\r
36 lNd4fCyHxedwf/kOu/+MR3XX2bDPhLsrEqz6Q=
\r
37 Received: by 10.204.189.74 with SMTP id dd10mr4575050bkb.174.1309236345754;
\r
38 Mon, 27 Jun 2011 21:45:45 -0700 (PDT)
\r
39 Received: from localhost ([91.144.186.21])
\r
40 by mx.google.com with ESMTPS id g13sm2876218bkd.10.2011.06.27.21.45.44
\r
41 (version=TLSv1/SSLv3 cipher=OTHER);
\r
42 Mon, 27 Jun 2011 21:45:45 -0700 (PDT)
\r
43 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
44 To: notmuch@notmuchmail.org
\r
45 Subject: [PATCH 08/10] test: set variables using `let' instead of `setq' in
\r
47 Date: Tue, 28 Jun 2011 08:45:09 +0400
\r
48 Message-Id: <1309236311-2162-8-git-send-email-dmitry.kurochkin@gmail.com>
\r
49 X-Mailer: git-send-email 1.7.5.4
\r
50 In-Reply-To: <1309236311-2162-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
51 References: <1309236311-2162-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
52 X-BeenThere: notmuch@notmuchmail.org
\r
53 X-Mailman-Version: 2.1.13
\r
55 List-Id: "Use and development of the notmuch mail system."
\r
56 <notmuch.notmuchmail.org>
\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
60 List-Post: <mailto:notmuch@notmuchmail.org>
\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
64 X-List-Received-Date: Tue, 28 Jun 2011 04:45:54 -0000
\r
66 Using `setq' for setting variables in Emacs tests affect other
\r
67 tests that may run in the same Emacs environment. Currently it
\r
68 works because each test is run in a separate Emacs instance. But
\r
69 in the future multiple tests will run in a single Emacs instance.
\r
70 The patch changes all variables to use `let', so the scope of the
\r
71 change is limited to a single test.
\r
73 test/emacs | 70 +++++++++++++++++++++++++++++------------------------
\r
74 test/test-lib.sh | 27 ++++++++++----------
\r
75 2 files changed, 52 insertions(+), 45 deletions(-)
\r
77 diff --git a/test/emacs b/test/emacs
\r
78 index 409e033..3d42645 100755
\r
84 +# Note: do not use `setq' for setting variables in Emacs tests because
\r
85 +# it affects other tests that may run in the same Emacs instance. Use
\r
86 +# `let' instead so the scope of the changed variables is limited to a
\r
89 test_description="emacs interface"
\r
92 @@ -12,20 +18,20 @@ test_emacs '(notmuch-hello)
\r
93 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello
\r
95 test_begin_subtest "Saved search with 0 results"
\r
96 -test_emacs '(setq notmuch-show-empty-saved-searches t)
\r
97 - (setq notmuch-saved-searches
\r
98 - '\''(("inbox" . "tag:inbox")
\r
99 - ("unread" . "tag:unread")
\r
100 - ("empty" . "tag:doesnotexist")))
\r
103 +test_emacs '(let ((notmuch-show-empty-saved-searches t)
\r
104 + (notmuch-saved-searches
\r
105 + '\''(("inbox" . "tag:inbox")
\r
106 + ("unread" . "tag:unread")
\r
107 + ("empty" . "tag:doesnotexist"))))
\r
110 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty
\r
112 test_begin_subtest "No saved searches displayed (all with 0 results)"
\r
113 -test_emacs '(setq notmuch-saved-searches
\r
114 - '\''(("empty" . "tag:doesnotexist")))
\r
117 +test_emacs '(let ((notmuch-saved-searches
\r
118 + '\''(("empty" . "tag:doesnotexist"))))
\r
121 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches
\r
123 test_begin_subtest "Basic notmuch-search view in emacs"
\r
124 @@ -147,9 +153,9 @@ output=$(notmuch search 'subject:"testing message sent via SMTP"' | notmuch_sear
\r
125 test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; Testing message sent via SMTP (inbox)"
\r
127 test_begin_subtest "notmuch-fcc-dirs set to nil"
\r
128 -test_emacs "(setq notmuch-fcc-dirs nil)
\r
129 - (notmuch-mua-mail)
\r
131 +test_emacs "(let ((notmuch-fcc-dirs nil))
\r
132 + (notmuch-mua-mail)
\r
134 cat <<EOF >EXPECTED
\r
135 From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
137 @@ -164,9 +170,9 @@ mkdir -p mail/sent-string/new
\r
138 mkdir -p mail/sent-string/tmp
\r
140 test_begin_subtest "notmuch-fcc-dirs set to a string"
\r
141 -test_emacs "(setq notmuch-fcc-dirs \"sent-string\")
\r
142 - (notmuch-mua-mail)
\r
144 +test_emacs "(let ((notmuch-fcc-dirs \"sent-string\"))
\r
145 + (notmuch-mua-mail)
\r
147 cat <<EOF >EXPECTED
\r
148 From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
150 @@ -185,11 +191,11 @@ mkdir -p mail/failure/new
\r
151 mkdir -p mail/failure/tmp
\r
153 test_begin_subtest "notmuch-fcc-dirs set to a list (with match)"
\r
154 -test_emacs "(setq notmuch-fcc-dirs
\r
155 - '((\"notmuchmail.org\" . \"sent-list-match\")
\r
156 - (\".*\" . \"failure\")))
\r
157 - (notmuch-mua-mail)
\r
159 +test_emacs "(let ((notmuch-fcc-dirs
\r
160 + '((\"notmuchmail.org\" . \"sent-list-match\")
\r
161 + (\".*\" . \"failure\"))))
\r
162 + (notmuch-mua-mail)
\r
164 cat <<EOF >EXPECTED
\r
165 From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
167 @@ -205,11 +211,11 @@ mkdir -p mail/sent-list-catch-all/new
\r
168 mkdir -p mail/sent-list-catch-all/tmp
\r
170 test_begin_subtest "notmuch-fcc-dirs set to a list (catch-all)"
\r
171 -test_emacs "(setq notmuch-fcc-dirs
\r
172 - '((\"example.com\" . \"failure\")
\r
173 - (\".*\" . \"sent-list-catch-all\")))
\r
174 - (notmuch-mua-mail)
\r
176 +test_emacs "(let ((notmuch-fcc-dirs
\r
177 + '((\"example.com\" . \"failure\")
\r
178 + (\".*\" . \"sent-list-catch-all\"))))
\r
179 + (notmuch-mua-mail)
\r
181 cat <<EOF >EXPECTED
\r
182 From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
184 @@ -220,11 +226,11 @@ EOF
\r
185 test_expect_equal_file OUTPUT EXPECTED
\r
187 test_begin_subtest "notmuch-fcc-dirs set to a list (no match)"
\r
188 -test_emacs "(setq notmuch-fcc-dirs
\r
189 - '((\"example.com\" . \"failure\")
\r
190 - (\"nomatchhere.net\" . \"failure\")))
\r
191 - (notmuch-mua-mail)
\r
193 +test_emacs "(let ((notmuch-fcc-dirs
\r
194 + '((\"example.com\" . \"failure\")
\r
195 + (\"nomatchhere.net\" . \"failure\"))))
\r
196 + (notmuch-mua-mail)
\r
198 cat <<EOF >EXPECTED
\r
199 From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
201 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
202 index ad1506c..7c8a86f 100755
\r
203 --- a/test/test-lib.sh
\r
204 +++ b/test/test-lib.sh
\r
205 @@ -394,19 +394,20 @@ emacs_deliver_message ()
\r
206 mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}
\r
207 ../smtp-dummy sent_message &
\r
209 - test_emacs "(setq message-send-mail-function 'message-smtpmail-send-it)
\r
210 - (setq smtpmail-smtp-server \"localhost\")
\r
211 - (setq smtpmail-smtp-service \"25025\")
\r
213 - (notmuch-mua-mail)
\r
214 - (message-goto-to)
\r
215 - (insert \"test_suite@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 -0000\")
\r
216 - (message-goto-subject)
\r
217 - (insert \"${subject}\")
\r
218 - (message-goto-body)
\r
219 - (insert \"${body}\")
\r
221 - (message-send-and-exit)" >/dev/null 2>&1
\r
223 + "(let ((message-send-mail-function 'message-smtpmail-send-it)
\r
224 + (smtpmail-smtp-server \"localhost\")
\r
225 + (smtpmail-smtp-service \"25025\"))
\r
227 + (notmuch-mua-mail)
\r
228 + (message-goto-to)
\r
229 + (insert \"test_suite@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 -0000\")
\r
230 + (message-goto-subject)
\r
231 + (insert \"${subject}\")
\r
232 + (message-goto-body)
\r
233 + (insert \"${body}\")
\r
235 + (message-send-and-exit))" >/dev/null 2>&1
\r
236 wait ${smtp_dummy_pid}
\r
237 notmuch new >/dev/null
\r