1 Return-Path: <bremner@tethera.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 28451431FBD
\r
6 for <notmuch@notmuchmail.org>; Tue, 21 Jan 2014 17:33:06 -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 pe+QB-haWx-g for <notmuch@notmuchmail.org>;
\r
16 Tue, 21 Jan 2014 17:32:59 -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 A231B431FAF
\r
21 for <notmuch@notmuchmail.org>; Tue, 21 Jan 2014 17:32:59 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tethera.net>)
\r
24 id 1W5mgc-0006Ys-Pa; Tue, 21 Jan 2014 21:32:58 -0400
\r
25 Received: (nullmailer pid 12484 invoked by uid 1000); Wed, 22 Jan 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [PATCH] test: make test_emacs call post-command-hook
\r
30 Date: Tue, 21 Jan 2014 21:32:45 -0400
\r
31 Message-Id: <1390354365-12311-1-git-send-email-david@tethera.net>
\r
32 X-Mailer: git-send-email 1.8.5.2
\r
33 In-Reply-To: <1387064676-15508-6-git-send-email-markwalters1009@gmail.com>
\r
34 References: <1387064676-15508-6-git-send-email-markwalters1009@gmail.com>
\r
35 X-BeenThere: notmuch@notmuchmail.org
\r
36 X-Mailman-Version: 2.1.13
\r
38 List-Id: "Use and development of the notmuch mail system."
\r
39 <notmuch.notmuchmail.org>
\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
41 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
43 List-Post: <mailto:notmuch@notmuchmail.org>
\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
47 X-List-Received-Date: Wed, 22 Jan 2014 01:33:06 -0000
\r
49 From: Mark Walters <markwalters1009@gmail.com>
\r
51 The unread/read changes will use the post-command-hook. test_emacs
\r
52 does not call the post-command-hook. This adds a notmuch-test-progn
\r
53 which takes a list of commands as argument and executes them in turn
\r
54 but runs the post-command-hook after each one.
\r
56 The caller can batch operations (ie to stop post-command-hook from
\r
57 being interleaved) by wrapping the batch of operations inside a progn.
\r
59 We also explicitly run the post-command-hook before getting the output
\r
60 from a test; this makes sense as this will be a place the user would
\r
61 be seeing the information.
\r
64 What do you think about this alternate version? it allows
\r
65 notmuch-test-progn to have the same syntax as progn. It seems about
\r
66 the same level of complexity to me; fwiw I prefer the let over the
\r
69 test/test-lib.el | 13 +++++++++++++
\r
70 test/test-lib.sh | 2 +-
\r
71 2 files changed, 14 insertions(+), 1 deletion(-)
\r
73 diff --git a/test/test-lib.el b/test/test-lib.el
\r
74 index 37fcb3d..a12ad97 100644
\r
75 --- a/test/test-lib.el
\r
76 +++ b/test/test-lib.el
\r
79 (defun test-output (&optional filename)
\r
80 "Save current buffer to file FILENAME. Default FILENAME is OUTPUT."
\r
81 + (notmuch-post-command)
\r
82 (write-region (point-min) (point-max) (or filename "OUTPUT")))
\r
84 (defun test-visible-output (&optional filename)
\r
85 "Save visible text in current buffer to file FILENAME. Default
\r
86 FILENAME is OUTPUT."
\r
87 + (notmuch-post-command)
\r
88 (let ((text (visible-buffer-string)))
\r
89 (with-temp-file (or filename "OUTPUT") (insert text))))
\r
91 @@ -165,3 +167,14 @@ nothing."
\r
94 (notmuch-test-report-unexpected output expected)))))
\r
96 +(defun notmuch-post-command ()
\r
97 + (run-hooks 'post-command-hook))
\r
99 +(defmacro notmuch-test-progn (&rest body)
\r
102 + (lambda (x) `(let ((ret ,x))
\r
103 + (notmuch-post-command)
\r
106 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
107 index 78af170..27dcb59 100644
\r
108 --- a/test/test-lib.sh
\r
109 +++ b/test/test-lib.sh
\r
110 @@ -1118,7 +1118,7 @@ test_emacs () {
\r
114 - ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(progn $@)"
\r
115 + ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $@)"
\r