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 754CE431FB6 for ; Mon, 16 Jan 2012 09:51:20 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.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 87oGYEmFSVRW for ; Mon, 16 Jan 2012 09:51:19 -0800 (PST) Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 8C434431FAF for ; Mon, 16 Jan 2012 09:51:19 -0800 (PST) Received: by bkat2 with SMTP id t2so4910958bka.26 for ; Mon, 16 Jan 2012 09:51:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=OVt/qbNHieR2y2fnOD+XqTycJ5JWTZkdna+2r1cAMks=; b=tqCvcgPnTo5eE31+fYXDEoV5INEnliSve2lYFliNLr6TXnv2Q6QESlWI5G1HkXq9w1 ve2Vh7+e/3BWvcBGjaNQYu94SaGUbchhV0aSFh+hxWR8dqRlKIzlmdjDXVzgx9eRxPI6 X/vCQJOdZU44BG4mrGEIKKIgRrCud4Hn1Q48g= Received: by 10.204.148.83 with SMTP id o19mr5401450bkv.132.1326736275571; Mon, 16 Jan 2012 09:51:15 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id d2sm41045447bky.11.2012.01.16.09.51.14 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jan 2012 09:51:14 -0800 (PST) From: Dmitry Kurochkin To: David Edmondson Subject: Re: [PATCH 1/2] test: Add "test_expect_emacs_t" to assist with emacs testing. In-Reply-To: <1326732453-23377-1-git-send-email-dme@dme.org> References: <1326732453-23377-1-git-send-email-dme@dme.org> User-Agent: Notmuch/0.11+68~gab6495e (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Mon, 16 Jan 2012 21:50:22 +0400 Message-ID: <87hazv8rkx.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: notmuch@notmuchmail.org 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 17:51:20 -0000 Hi David. On Mon, 16 Jan 2012 16:47:32 +0000, David Edmondson wrote: > "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. Isn't this function the same as something like "test_expect_equal $x t"? IMO the function seems too complex for what it does (and basically that is "compare $x with t"). Why do we need to implement it in such a way? Also, the function has nothing to do with emacs (except for the fact that 't' is commonly used in it). I think a more useful approach would be to add a function which takes a lisp expression, runs test_emacs and compares the result with "t" using test_expect_equal or similar. This way you do not need to make an explicit test_emacs call and avoid code duplication when checking the result. test_emacs_expect_t should be a good name for it. What do you think? Regards, Dmitry > --- > > 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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch