RE: Reply all - issue
[notmuch-archives.git] / da / 521e0bd91fe9f39cffa063ebe8c43d06f50173
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 DA7A3431FC3\r
6         for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 07:25:41 -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 D47bbXbuxxOk for <notmuch@notmuchmail.org>;\r
17         Tue, 24 Jan 2012 07:25:41 -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 F2A94431FB6\r
22         for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 07:25:40 -0800 (PST)\r
23 Received: by bkbzt19 with SMTP id zt19so2471534bkb.26\r
24         for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 07:25:39 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type;\r
28         bh=KmKOwMtsjWgH2tTOkXtFfSmbaZv/AuIGur5ti23SZOk=;\r
29         b=iUVIVLuxaU876m+xrQH/RqXNCVE9kJuHFfo47MZ4O9okFq5n4+HeGU/MxIpB/DaQRz\r
30         VUsqOqPnJ0pkWpFx1Gy8NUYlMlJQxT+5SDD2EbLUY1IbQNoIMG1qHIA42+s2ei3kzoCo\r
31         aL5iselKbwdtTvQtSqL8qaPHCYXHF9YdXDHsQ=\r
32 Received: by 10.205.131.13 with SMTP id ho13mr3502284bkc.58.1327418739661;\r
33         Tue, 24 Jan 2012 07:25:39 -0800 (PST)\r
34 Received: from localhost ([91.144.186.21])\r
35         by mx.google.com with ESMTPS id d2sm36997318bky.11.2012.01.24.07.25.38\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Tue, 24 Jan 2012 07:25:39 -0800 (PST)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
40 Subject: Re: [PATCH 2/4 v42] test: Add `test_emacs_expect_t'.\r
41 In-Reply-To: <1327341947-29206-2-git-send-email-dme@dme.org>\r
42 References: <1326804748-8989-2-git-send-email-dme@dme.org>\r
43         <1327341947-29206-1-git-send-email-dme@dme.org>\r
44         <1327341947-29206-2-git-send-email-dme@dme.org>\r
45 User-Agent: Notmuch/0.11+100~gd650abf (http://notmuchmail.org) Emacs/23.3.1\r
46         (x86_64-pc-linux-gnu)\r
47 Date: Tue, 24 Jan 2012 19:24:33 +0400\r
48 Message-ID: <87ehupm8cu.fsf@gmail.com>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain; charset=us-ascii\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: Tue, 24 Jan 2012 15:25:42 -0000\r
64 \r
65 On Mon, 23 Jan 2012 18:05:45 +0000, David Edmondson <dme@dme.org> wrote:\r
66 > Add a new test function to allow simpler testing of emacs\r
67 > functionality.\r
68\r
69 > `test_emacs_expect_t' takes one argument - a lisp expression to\r
70 > evaluate. The test passes if the expression returns `t', otherwise it\r
71 > fails and the output is reported to the tester.\r
72 > ---\r
73\r
74 > As per Dmitry:\r
75 >  - don't call `test_skip' twice,\r
76 >  - allow for a prereq.\r
77\r
78 \r
79 LGTM\r
80 \r
81 Regards,\r
82   Dmitry\r
83 \r
84 >  test/README                  |    8 ++++++++\r
85 >  test/emacs-test-functions.sh |    9 +++++++++\r
86 >  test/notmuch-test            |    1 +\r
87 >  test/test-lib.el             |    9 +++++++++\r
88 >  test/test-lib.sh             |   29 +++++++++++++++++++++++++++++\r
89 >  5 files changed, 56 insertions(+), 0 deletions(-)\r
90 >  create mode 100755 test/emacs-test-functions.sh\r
91\r
92 > diff --git a/test/README b/test/README\r
93 > index 44ff653..43656a3 100644\r
94 > --- a/test/README\r
95 > +++ b/test/README\r
96 > @@ -202,6 +202,14 @@ library for your script to use.\r
97 >     tests that may run in the same Emacs instance.  Use `let' instead\r
98 >     so the scope of the changed variables is limited to a single test.\r
99 >  \r
100 > + test_emacs_expect_t <emacs-lisp-expressions>\r
101 > +\r
102 > +  This function executes the provided emacs lisp script within\r
103 > +  emacs in a manner similar to 'test_emacs'. The expressions should\r
104 > +  return the value `t' to indicate that the test has passed. If the\r
105 > +  test does not return `t' then it is considered failed and all data\r
106 > +  returned by the test is reported to the tester.\r
107 > +\r
108 >   test_done\r
109 >  \r
110 >     Your test script must have test_done at the end.  Its purpose\r
111 > diff --git a/test/emacs-test-functions.sh b/test/emacs-test-functions.sh\r
112 > new file mode 100755\r
113 > index 0000000..0e1f9fc\r
114 > --- /dev/null\r
115 > +++ b/test/emacs-test-functions.sh\r
116 > @@ -0,0 +1,9 @@\r
117 > +#!/usr/bin/env bash\r
118 > +\r
119 > +test_description="emacs test function sanity"\r
120 > +. test-lib.sh\r
121 > +\r
122 > +test_begin_subtest "emacs test function sanity"\r
123 > +test_emacs_expect_t 't'\r
124 > +\r
125 > +test_done\r
126 > diff --git a/test/notmuch-test b/test/notmuch-test\r
127 > index 6a99ae3..d034f99 100755\r
128 > --- a/test/notmuch-test\r
129 > +++ b/test/notmuch-test\r
130 > @@ -52,6 +52,7 @@ TESTS="\r
131 >    python\r
132 >    hooks\r
133 >    argument-parsing\r
134 > +  emacs-test-functions.sh\r
135 >  "\r
136 >  TESTS=${NOTMUCH_TESTS:=$TESTS}\r
137 >  \r
138 > diff --git a/test/test-lib.el b/test/test-lib.el\r
139 > index 59c5868..96752f0 100644\r
140 > --- a/test/test-lib.el\r
141 > +++ b/test/test-lib.el\r
142 > @@ -83,3 +83,12 @@ nothing."\r
143 >  \r
144 >  (add-hook-counter 'notmuch-hello-mode-hook)\r
145 >  (add-hook-counter 'notmuch-hello-refresh-hook)\r
146 > +\r
147 > +(defmacro notmuch-test-run (&rest body)\r
148 > +  "Evaluate a BODY of test expressions and output the result."\r
149 > +  `(with-temp-buffer\r
150 > +     (let ((result (progn ,@body)))\r
151 > +       (insert (if (stringp result)\r
152 > +                result\r
153 > +              (prin1-to-string result)))\r
154 > +       (test-output))))\r
155 > diff --git a/test/test-lib.sh b/test/test-lib.sh\r
156 > index 82c686c..8158328 100644\r
157 > --- a/test/test-lib.sh\r
158 > +++ b/test/test-lib.sh\r
159 > @@ -503,6 +503,35 @@ test_expect_equal_file ()\r
160 >      fi\r
161 >  }\r
162 >  \r
163 > +test_emacs_expect_t () {\r
164 > +     test "$#" = 2 && { prereq=$1; shift; } || prereq=\r
165 > +     test "$#" = 1 ||\r
166 > +     error "bug in the test script: not 1 or 2 parameters to test_emacs_expect_t"\r
167 > +\r
168 > +     # Run the test.\r
169 > +     if ! test_skip "$test_subtest_name"\r
170 > +     then\r
171 > +             test_emacs "(notmuch-test-run $1)" >/dev/null\r
172 > +\r
173 > +             # Restore state after the test.\r
174 > +             exec 1>&6 2>&7          # Restore stdout and stderr\r
175 > +             inside_subtest=\r
176 > +\r
177 > +             # Report success/failure.\r
178 > +             result=$(cat OUTPUT)\r
179 > +             if [ "$result" = t ]\r
180 > +             then\r
181 > +                     test_ok_ "$test_subtest_name"\r
182 > +             else\r
183 > +                     test_failure_ "$test_subtest_name" "${result}"\r
184 > +             fi\r
185 > +     else\r
186 > +             # Restore state after the (non) test.\r
187 > +             exec 1>&6 2>&7          # Restore stdout and stderr\r
188 > +             inside_subtest=\r
189 > +     fi\r
190 > +}\r
191 > +\r
192 >  NOTMUCH_NEW ()\r
193 >  {\r
194 >      notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'\r
195 > -- \r
196 > 1.7.8.3\r
197\r
198 > _______________________________________________\r
199 > notmuch mailing list\r
200 > notmuch@notmuchmail.org\r
201 > http://notmuchmail.org/mailman/listinfo/notmuch\r