1 Return-Path: <jani@nikula.org>
\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 394EE431FB6
\r
6 for <notmuch@notmuchmail.org>; Thu, 31 May 2012 01:28:31 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id mXTPFzHpc6de for <notmuch@notmuchmail.org>;
\r
16 Thu, 31 May 2012 01:28:30 -0700 (PDT)
\r
17 Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com
\r
18 [209.85.212.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 65241431FAF
\r
21 for <notmuch@notmuchmail.org>; Thu, 31 May 2012 01:28:30 -0700 (PDT)
\r
22 Received: by vbbfc26 with SMTP id fc26so641586vbb.26
\r
23 for <notmuch@notmuchmail.org>; Thu, 31 May 2012 01:28:29 -0700 (PDT)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=google.com; s=20120113;
\r
26 h=from:to:subject:in-reply-to:references:user-agent:date:message-id
\r
27 :mime-version:content-type:x-gm-message-state;
\r
28 bh=jC/d4Xg4c5RkXjuWnQezPJITZ3Hgigtwerv96FwW5j4=;
\r
29 b=lGsG57Tme5TiBuKjgKM26MnRV4KgrsRUfdAyJbPBd/Q9FX3XCPEewIZhNQN7otLndf
\r
30 iaFzCuIVtX/aZJ9BhkSLHT+SPAtcVeHkDlxxRDr/YB30VRhkCKURIdV3EE81qcLClAZ+
\r
31 pgAfUxBzsOUNf6C+bDqSpHnGD1tSuq91/NuRMD2F88kBtyketQLyUEs7mI5qkYYRFjTt
\r
32 8iNioSLSY0qCD7NB9nAJGHtlrW8TdcX7A8b9tjg9trRezUL84rV/cmgLG07VFpI+bgla
\r
33 F6hiqYsuux3S3stmLkiWijZUejzJnGvHiIFQ+dHYMHP9TNXvX0t8NszePTqwR7sjvL1i
\r
35 Received: by 10.220.241.130 with SMTP id le2mr7243345vcb.38.1338452909690;
\r
36 Thu, 31 May 2012 01:28:29 -0700 (PDT)
\r
37 Received: from localhost (nikula.org. [92.243.24.172])
\r
38 by mx.google.com with ESMTPS id i19sm3750912vdt.18.2012.05.31.01.28.27
\r
39 (version=SSLv3 cipher=OTHER); Thu, 31 May 2012 01:28:28 -0700 (PDT)
\r
40 From: Jani Nikula <jani@nikula.org>
\r
41 To: Tomi Ollila <tomi.ollila@iki.fi>,
\r
42 Jameson Graef Rollins <jrollins@finestructure.net>,
\r
43 Mike Kelly <pioto@pioto.org>, notmuch@notmuchmail.org
\r
44 Subject: Re: [PATCH v2 7/9] test/count: fix numeric comparision tests on
\r
46 In-Reply-To: <m2fwahxu2l.fsf@guru.guru-group.fi>
\r
47 References: <1338361324-57289-1-git-send-email-pioto@pioto.org>
\r
48 <1338361324-57289-8-git-send-email-pioto@pioto.org>
\r
49 <877gvtxvka.fsf@servo.finestructure.net>
\r
50 <m2fwahxu2l.fsf@guru.guru-group.fi>
\r
51 User-Agent: Notmuch/0.13+9~ga1668d0 (http://notmuchmail.org) Emacs/23.1.1
\r
53 Date: Thu, 31 May 2012 08:28:24 +0000
\r
54 Message-ID: <874nqw4uvr.fsf@nikula.org>
\r
56 Content-Type: text/plain; charset=us-ascii
\r
58 ALoCoQkrNFDNddCV3PnikfuzAydYQxHNP2KVhylomc2a+5Xaor8lvnOEwaIPdqCrTvfhH2OkIRBz
\r
59 X-BeenThere: notmuch@notmuchmail.org
\r
60 X-Mailman-Version: 2.1.13
\r
62 List-Id: "Use and development of the notmuch mail system."
\r
63 <notmuch.notmuchmail.org>
\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
67 List-Post: <mailto:notmuch@notmuchmail.org>
\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
71 X-List-Received-Date: Thu, 31 May 2012 08:28:31 -0000
\r
73 On Wed, 30 May 2012, Tomi Ollila <tomi.ollila@iki.fi> wrote:
\r
74 > On Wed, May 30 2012, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
\r
76 >> On Wed, May 30 2012, Mike Kelly <pioto@pioto.org> wrote:
\r
77 >>> FreeBSD's `wc -l` includes some white space in front of the number.
\r
78 >>> Instead, we add a test_expect_equal_num() to test-lib.sh, which ensures
\r
79 >>> we do a proper numeric comparision, and in a portable way.
\r
81 >> Is there a way we can avoid adding another new test function here? This
\r
82 >> new function is almost completely identical with the old one, except
\r
83 >> that it uses "test .. -eq" instead of "[ .. =". If the problem is just
\r
84 >> that the arguments occasionally contain superfluous spaces, I would
\r
85 >> rather see the existing function just strip the spaces. Of maybe add an
\r
86 >> option to the test to ask for arithmetic rather than string comparison.
\r
87 >> That would be preferable to introducing an new function that is
\r
88 >> confusingly similar to an existing one.
\r
90 > I liked Mike's suggestion as I also thought the options; stripping in
\r
91 > test_expect_equal cannot be done as there might be whitespace differences
\r
92 > which mean failure arguments to test_expect_equal cannot be given without
\r
93 > quotes as variable might be split into multiple args. if test_expect_equal
\r
94 > were changed to take comparison argument (like '-eq' or '=') then all
\r
95 > calls would need to be changes (and function name could be changed to
\r
96 > something more generic...) None of these sounded as good options...
\r
98 > But, there is at least one option more:
\r
100 > test_expect_equal \
\r
101 > - "`notmuch search --output=messages ${SEARCH} | wc -l`" \
\r
102 > + "$((`notmuch search --output=messages ${SEARCH} | wc -l`))" \
\r
103 > "`notmuch count --output=messages ${SEARCH}`"
\r
105 > this makes arithmetic evaluation -- no operation to be done but
\r
106 > the spaces around the value are dropped.
\r
108 But it's non-obvious. How about just adding '| tr -d " "' to the end and
\r
119 > _______________________________________________
\r
120 > notmuch mailing list
\r
121 > notmuch@notmuchmail.org
\r
122 > http://notmuchmail.org/mailman/listinfo/notmuch
\r