Re: [PATCH 1/2] test: Add "test_expect_emacs_t" to assist with emacs testing.
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Mon, 16 Jan 2012 17:50:22 +0000 (21:50 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:42:18 +0000 (09:42 -0800)
c6/a10776aabb3b5bb4ab43c7da79303ea55f8caf [new file with mode: 0644]

diff --git a/c6/a10776aabb3b5bb4ab43c7da79303ea55f8caf b/c6/a10776aabb3b5bb4ab43c7da79303ea55f8caf
new file mode 100644 (file)
index 0000000..bcc7672
--- /dev/null
@@ -0,0 +1,134 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 754CE431FB6\r
+       for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 09:51:20 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 87oGYEmFSVRW for <notmuch@notmuchmail.org>;\r
+       Mon, 16 Jan 2012 09:51:19 -0800 (PST)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 8C434431FAF\r
+       for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 09:51:19 -0800 (PST)\r
+Received: by bkat2 with SMTP id t2so4910958bka.26\r
+       for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 09:51:16 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
+       :message-id:mime-version:content-type;\r
+       bh=OVt/qbNHieR2y2fnOD+XqTycJ5JWTZkdna+2r1cAMks=;\r
+       b=tqCvcgPnTo5eE31+fYXDEoV5INEnliSve2lYFliNLr6TXnv2Q6QESlWI5G1HkXq9w1\r
+       ve2Vh7+e/3BWvcBGjaNQYu94SaGUbchhV0aSFh+hxWR8dqRlKIzlmdjDXVzgx9eRxPI6\r
+       X/vCQJOdZU44BG4mrGEIKKIgRrCud4Hn1Q48g=\r
+Received: by 10.204.148.83 with SMTP id o19mr5401450bkv.132.1326736275571;\r
+       Mon, 16 Jan 2012 09:51:15 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id d2sm41045447bky.11.2012.01.16.09.51.14\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Mon, 16 Jan 2012 09:51:14 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: David Edmondson <dme@dme.org>\r
+Subject: Re: [PATCH 1/2] test: Add "test_expect_emacs_t" to assist with emacs\r
+       testing.\r
+In-Reply-To: <1326732453-23377-1-git-send-email-dme@dme.org>\r
+References: <1326732453-23377-1-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.11+68~gab6495e (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Mon, 16 Jan 2012 21:50:22 +0400\r
+Message-ID: <87hazv8rkx.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 16 Jan 2012 17:51:20 -0000\r
+\r
+Hi David.\r
+\r
+On Mon, 16 Jan 2012 16:47:32 +0000, David Edmondson <dme@dme.org> wrote:\r
+> "test_expect_emacs_t" expects a single argument. If this is `t' then\r
+> the test passes. Otherwise the argument provides the details of the\r
+> test failure to be reported.\r
+\r
+Isn't this function the same as something like "test_expect_equal $x t"?\r
+\r
+IMO the function seems too complex for what it does (and basically that\r
+is "compare $x with t").  Why do we need to implement it in such a way?\r
+\r
+Also, the function has nothing to do with emacs (except for the fact\r
+that 't' is commonly used in it).\r
+\r
+I think a more useful approach would be to add a function which takes a\r
+lisp expression, runs test_emacs and compares the result with "t" using\r
+test_expect_equal or similar.  This way you do not need to make an\r
+explicit test_emacs call and avoid code duplication when checking the\r
+result.  test_emacs_expect_t should be a good name for it.  What do you\r
+think?\r
+\r
+Regards,\r
+  Dmitry\r
+\r
+> ---\r
+> \r
+> For use in the following set of tests and later for other emacs related tests.\r
+> \r
+>  test/test-lib.sh |   20 ++++++++++++++++++++\r
+>  1 files changed, 20 insertions(+), 0 deletions(-)\r
+> \r
+> diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+> index d1fbc05..0ffe9a6 100644\r
+> --- a/test/test-lib.sh\r
+> +++ b/test/test-lib.sh\r
+> @@ -503,6 +503,26 @@ test_expect_equal_file ()\r
+>      fi\r
+>  }\r
+>  \r
+> +# Pass test if the result is `t', else report the results.\r
+> +test_expect_emacs_t ()\r
+> +{\r
+> +    exec 1>&6 2>&7          # Restore stdout and stderr\r
+> +    inside_subtest=\r
+> +    test "$#" = 1 ||\r
+> +    error "bug in the test script: not 1 parameter to test_expect_emacs_t"\r
+> +\r
+> +    result="$1"\r
+> +    if ! test_skip "$test_subtest_name"\r
+> +    then\r
+> +            if [ "${result}" == "t" ] ; then\r
+> +                    test_ok_ "$test_subtest_name"\r
+> +            else\r
+> +                    testname=$this_test.$test_count\r
+> +                    test_failure_ "$test_subtest_name" "$(eval printf ${result})"\r
+> +            fi\r
+> +    fi\r
+> +}\r
+> +\r
+>  NOTMUCH_NEW ()\r
+>  {\r
+>      notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'\r
+> -- \r
+> 1.7.7.3\r
+> \r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r