From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id CF530431FD4 for ; Tue, 25 Mar 2014 13:03:33 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9tixTp3LZm1y for ; Tue, 25 Mar 2014 13:03:29 -0700 (PDT) Received: from mail-we0-f180.google.com (mail-we0-f180.google.com [74.125.82.180]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 02557431FC2 for ; Tue, 25 Mar 2014 13:03:28 -0700 (PDT) Received: by mail-we0-f180.google.com with SMTP id p61so696471wes.11 for ; Tue, 25 Mar 2014 13:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K2IF/+hfJBbwhIAhHdEDx1DdAEOD0dVeR/XD/W1urMQ=; b=0FVL9rsiUm34iUQ+NprYytuTriu269wnpmqP0dBCEgosIr7fQ33KfMRTLsVCdvBLwz f69Xi/2+cR0Rqr8Szb/t5VdJCHl6UFnGsW7DWCYYMFquMCDUgF1kCFpa1qwTiUSn+3AV SpByiFzVxSS8KAfEvuvtBkOhC3ClKmDYTGha4cpv4vI2RrzQ+72BdPvS8KI2OuusGOAQ agMuoHUceWCArtiaf3Mxo2PzeD21aOLVba5TkkeNgID++mWU6l3S/d7PHl5OY8wCsYU8 /i7u6GTTaaiv6QG52mh9ppu1OljcFhkUjJPFj+QUloFled/Z9pSzOxk60JcrrVvbNNYf va/Q== X-Received: by 10.180.165.238 with SMTP id zb14mr25915148wib.51.1395777799348; Tue, 25 Mar 2014 13:03:19 -0700 (PDT) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id dd5sm984658wib.12.2014.03.25.13.03.18 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 25 Mar 2014 13:03:18 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [Patch v3 1/3] test: make test_emacs call post-command-hook Date: Tue, 25 Mar 2014 20:03:11 +0000 Message-Id: <1395777793-13297-2-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395777793-13297-1-git-send-email-markwalters1009@gmail.com> References: <1395777793-13297-1-git-send-email-markwalters1009@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Mar 2014 20:03:34 -0000 From: David Bremner The unread/read changes will use the post-command-hook. test_emacs does not call the post-command-hook. This adds a notmuch-test-progn which takes a list of commands as argument and executes them in turn but runs the post-command-hook after each one. The caller can batch operations (ie to stop post-command-hook from being interleaved) by wrapping the batch of operations inside a progn. We also explicitly run the post-command-hook before getting the output from a test; this makes sense as this will be a place the user would be seeing the information. --- test/test-lib.el | 11 +++++++++++ test/test-lib.sh | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/test-lib.el b/test/test-lib.el index 437f83f..36afe63 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -52,11 +52,13 @@ (defun notmuch-test-wait () (defun test-output (&optional filename) "Save current buffer to file FILENAME. Default FILENAME is OUTPUT." + (notmuch-post-command) (write-region (point-min) (point-max) (or filename "OUTPUT"))) (defun test-visible-output (&optional filename) "Save visible text in current buffer to file FILENAME. Default FILENAME is OUTPUT." + (notmuch-post-command) (let ((text (visible-buffer-string))) (with-temp-file (or filename "OUTPUT") (insert text)))) @@ -166,6 +168,15 @@ (defun notmuch-test-expect-equal (output expected) (t (notmuch-test-report-unexpected output expected))))) +(defun notmuch-post-command () + (run-hooks 'post-command-hook)) + +(defmacro notmuch-test-progn (&rest body) + (cons 'progn + (mapcar + (lambda (x) `(prog1 ,x (notmuch-post-command))) + body))) + ;; For historical reasons, we hide deleted tags by default in the test ;; suite (setq notmuch-tag-deleted-formats diff --git a/test/test-lib.sh b/test/test-lib.sh index 8697d6a..e6403e5 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -1139,7 +1139,7 @@ test_emacs () { rm -f OUTPUT touch OUTPUT - ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(progn $@)" + ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $@)" } test_python() { -- 1.7.10.4