Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 7FE62431FCB for ; Mon, 16 Jan 2012 08:47:44 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[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 2k9FKu2IEPkm for ; Mon, 16 Jan 2012 08:47:40 -0800 (PST) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id B3009431FAE for ; Mon, 16 Jan 2012 08:47:38 -0800 (PST) Received: by mail-ww0-f45.google.com with SMTP id dr13so398317wgb.2 for ; Mon, 16 Jan 2012 08:47:38 -0800 (PST) Received: by 10.180.14.72 with SMTP id n8mr21365246wic.22.1326732458400; Mon, 16 Jan 2012 08:47:38 -0800 (PST) Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id di5sm35021507wib.3.2012.01.16.08.47.36 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jan 2012 08:47:37 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 5ECF2A0397; Mon, 16 Jan 2012 16:47:35 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH 1/2] test: Add "test_expect_emacs_t" to assist with emacs testing. Date: Mon, 16 Jan 2012 16:47:32 +0000 Message-Id: <1326732453-23377-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.7.3 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: Mon, 16 Jan 2012 16:47:44 -0000 "test_expect_emacs_t" expects a single argument. If this is `t' then the test passes. Otherwise the argument provides the details of the test failure to be reported. --- For use in the following set of tests and later for other emacs related tests. test/test-lib.sh | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index d1fbc05..0ffe9a6 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -503,6 +503,26 @@ test_expect_equal_file () fi } +# Pass test if the result is `t', else report the results. +test_expect_emacs_t () +{ + exec 1>&6 2>&7 # Restore stdout and stderr + inside_subtest= + test "$#" = 1 || + error "bug in the test script: not 1 parameter to test_expect_emacs_t" + + result="$1" + if ! test_skip "$test_subtest_name" + then + if [ "${result}" == "t" ] ; then + test_ok_ "$test_subtest_name" + else + testname=$this_test.$test_count + test_failure_ "$test_subtest_name" "$(eval printf ${result})" + fi + fi +} + NOTMUCH_NEW () { notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file' -- 1.7.7.3