Re: [PATCH v7 0/3] NEWS and test comment adjustments
[notmuch-archives.git] / c6 / a10776aabb3b5bb4ab43c7da79303ea55f8caf
1 Return-Path: <dmitry.kurochkin@gmail.com>\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 754CE431FB6\r
6         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 09:51:20 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id 87oGYEmFSVRW for <notmuch@notmuchmail.org>;\r
17         Mon, 16 Jan 2012 09:51:19 -0800 (PST)\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 8C434431FAF\r
22         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 09:51:19 -0800 (PST)\r
23 Received: by bkat2 with SMTP id t2so4910958bka.26\r
24         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 09:51:16 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
27         :message-id:mime-version:content-type;\r
28         bh=OVt/qbNHieR2y2fnOD+XqTycJ5JWTZkdna+2r1cAMks=;\r
29         b=tqCvcgPnTo5eE31+fYXDEoV5INEnliSve2lYFliNLr6TXnv2Q6QESlWI5G1HkXq9w1\r
30         ve2Vh7+e/3BWvcBGjaNQYu94SaGUbchhV0aSFh+hxWR8dqRlKIzlmdjDXVzgx9eRxPI6\r
31         X/vCQJOdZU44BG4mrGEIKKIgRrCud4Hn1Q48g=\r
32 Received: by 10.204.148.83 with SMTP id o19mr5401450bkv.132.1326736275571;\r
33         Mon, 16 Jan 2012 09:51:15 -0800 (PST)\r
34 Received: from localhost ([91.144.186.21])\r
35         by mx.google.com with ESMTPS id d2sm41045447bky.11.2012.01.16.09.51.14\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Mon, 16 Jan 2012 09:51:14 -0800 (PST)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: David Edmondson <dme@dme.org>\r
40 Subject: Re: [PATCH 1/2] test: Add "test_expect_emacs_t" to assist with emacs\r
41         testing.\r
42 In-Reply-To: <1326732453-23377-1-git-send-email-dme@dme.org>\r
43 References: <1326732453-23377-1-git-send-email-dme@dme.org>\r
44 User-Agent: Notmuch/0.11+68~gab6495e (http://notmuchmail.org) Emacs/23.3.1\r
45         (x86_64-pc-linux-gnu)\r
46 Date: Mon, 16 Jan 2012 21:50:22 +0400\r
47 Message-ID: <87hazv8rkx.fsf@gmail.com>\r
48 MIME-Version: 1.0\r
49 Content-Type: text/plain; charset=us-ascii\r
50 Cc: notmuch@notmuchmail.org\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Mon, 16 Jan 2012 17:51:20 -0000\r
64 \r
65 Hi David.\r
66 \r
67 On Mon, 16 Jan 2012 16:47:32 +0000, David Edmondson <dme@dme.org> wrote:\r
68 > "test_expect_emacs_t" expects a single argument. If this is `t' then\r
69 > the test passes. Otherwise the argument provides the details of the\r
70 > test failure to be reported.\r
71 \r
72 Isn't this function the same as something like "test_expect_equal $x t"?\r
73 \r
74 IMO the function seems too complex for what it does (and basically that\r
75 is "compare $x with t").  Why do we need to implement it in such a way?\r
76 \r
77 Also, the function has nothing to do with emacs (except for the fact\r
78 that 't' is commonly used in it).\r
79 \r
80 I think a more useful approach would be to add a function which takes a\r
81 lisp expression, runs test_emacs and compares the result with "t" using\r
82 test_expect_equal or similar.  This way you do not need to make an\r
83 explicit test_emacs call and avoid code duplication when checking the\r
84 result.  test_emacs_expect_t should be a good name for it.  What do you\r
85 think?\r
86 \r
87 Regards,\r
88   Dmitry\r
89 \r
90 > ---\r
91\r
92 > For use in the following set of tests and later for other emacs related tests.\r
93\r
94 >  test/test-lib.sh |   20 ++++++++++++++++++++\r
95 >  1 files changed, 20 insertions(+), 0 deletions(-)\r
96\r
97 > diff --git a/test/test-lib.sh b/test/test-lib.sh\r
98 > index d1fbc05..0ffe9a6 100644\r
99 > --- a/test/test-lib.sh\r
100 > +++ b/test/test-lib.sh\r
101 > @@ -503,6 +503,26 @@ test_expect_equal_file ()\r
102 >      fi\r
103 >  }\r
104 >  \r
105 > +# Pass test if the result is `t', else report the results.\r
106 > +test_expect_emacs_t ()\r
107 > +{\r
108 > +     exec 1>&6 2>&7          # Restore stdout and stderr\r
109 > +     inside_subtest=\r
110 > +     test "$#" = 1 ||\r
111 > +     error "bug in the test script: not 1 parameter to test_expect_emacs_t"\r
112 > +\r
113 > +     result="$1"\r
114 > +     if ! test_skip "$test_subtest_name"\r
115 > +     then\r
116 > +             if [ "${result}" == "t" ] ; then\r
117 > +                     test_ok_ "$test_subtest_name"\r
118 > +             else\r
119 > +                     testname=$this_test.$test_count\r
120 > +                     test_failure_ "$test_subtest_name" "$(eval printf ${result})"\r
121 > +             fi\r
122 > +    fi\r
123 > +}\r
124 > +\r
125 >  NOTMUCH_NEW ()\r
126 >  {\r
127 >      notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'\r
128 > -- \r
129 > 1.7.7.3\r
130\r
131 > _______________________________________________\r
132 > notmuch mailing list\r
133 > notmuch@notmuchmail.org\r
134 > http://notmuchmail.org/mailman/listinfo/notmuch\r