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 E1F16431FBC
\r
6 for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 07:52:37 -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 c07M9uD7aWOZ for <notmuch@notmuchmail.org>;
\r
16 Fri, 24 Jan 2014 07:52:33 -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 8CF24431FB6
\r
21 for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 07:52:33 -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 1W6j3Z-0004ln-1P; Fri, 24 Jan 2014 11:52:33 -0400
\r
25 Received: (nullmailer pid 30602 invoked by uid 1000); Fri, 24 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: Fri, 24 Jan 2014 11:52:24 -0400
\r
31 Message-Id: <1390578744-30516-1-git-send-email-david@tethera.net>
\r
32 X-Mailer: git-send-email 1.8.5.2
\r
33 In-Reply-To: <m2lhy5whok.fsf@guru.guru-group.fi>
\r
34 References: <m2lhy5whok.fsf@guru.guru-group.fi>
\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: Fri, 24 Jan 2014 15:52:38 -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 OK, OK, so the previous version re-invented prog1. That's the scheme
\r
67 test/test-lib.el | 11 +++++++++++
\r
68 test/test-lib.sh | 2 +-
\r
69 2 files changed, 12 insertions(+), 1 deletion(-)
\r
71 diff --git a/test/test-lib.el b/test/test-lib.el
\r
72 index 37fcb3d..0ee8371 100644
\r
73 --- a/test/test-lib.el
\r
74 +++ b/test/test-lib.el
\r
77 (defun test-output (&optional filename)
\r
78 "Save current buffer to file FILENAME. Default FILENAME is OUTPUT."
\r
79 + (notmuch-post-command)
\r
80 (write-region (point-min) (point-max) (or filename "OUTPUT")))
\r
82 (defun test-visible-output (&optional filename)
\r
83 "Save visible text in current buffer to file FILENAME. Default
\r
84 FILENAME is OUTPUT."
\r
85 + (notmuch-post-command)
\r
86 (let ((text (visible-buffer-string)))
\r
87 (with-temp-file (or filename "OUTPUT") (insert text))))
\r
89 @@ -165,3 +167,12 @@ nothing."
\r
92 (notmuch-test-report-unexpected output expected)))))
\r
94 +(defun notmuch-post-command ()
\r
95 + (run-hooks 'post-command-hook))
\r
97 +(defmacro notmuch-test-progn (&rest body)
\r
100 + (lambda (x) `(prog1 ,x (notmuch-post-command)))
\r
102 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
103 index 78af170..27dcb59 100644
\r
104 --- a/test/test-lib.sh
\r
105 +++ b/test/test-lib.sh
\r
106 @@ -1118,7 +1118,7 @@ test_emacs () {
\r
110 - ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(progn $@)"
\r
111 + ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $@)"
\r