1 Return-Path: <pioto@pioto.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 A217E431FD2
\r
6 for <notmuch@notmuchmail.org>; Wed, 30 May 2012 00:02:58 -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 9bO3j2l6BRok for <notmuch@notmuchmail.org>;
\r
16 Wed, 30 May 2012 00:02:57 -0700 (PDT)
\r
17 Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com
\r
18 [209.85.220.181]) (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 F3C43431FAF
\r
21 for <notmuch@notmuchmail.org>; Wed, 30 May 2012 00:02:55 -0700 (PDT)
\r
22 Received: by mail-vc0-f181.google.com with SMTP id f1so4187995vcb.26
\r
23 for <notmuch@notmuchmail.org>; Wed, 30 May 2012 00:02:55 -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:cc:subject:date:message-id:x-mailer:in-reply-to:references
\r
27 :x-gm-message-state;
\r
28 bh=p6l7vxdTZnwwRJ6TCqtNq8A8oPuCnSvrVnR/UcLpeGg=;
\r
29 b=gLaWg9Sle+lK/ESBPijfXa+fPfzhFB5Plyp0vFW2JIsR9DctwLu2c1pe8yO7kZQSud
\r
30 ShOvZoGYlyWYdHQAtu8n2yZ7SyYSnGO+W3kZ4dsoj4nPFDbH5UVlf++0YRDCDuMTa4xk
\r
31 k66A/g65GPfk1Q4Uvls7xMkCyFPwOijlZ1PWE8YipPmMFTMZRMRVzvZMaXzVIBq846rC
\r
32 DXp651shmEKbtWOOySZsfe0zkzzqt+h4vpmEjBekC5RjgT7ZfrQBaP4qxuPhiFvYIzKh
\r
33 7qdCrn9iF8lA6DYEPV4FyFaslFJB7bCf6aI5iiW562aLDAQWIGyCZcJ9q0vzOBpNjmUR
\r
35 Received: by 10.52.90.199 with SMTP id by7mr13350786vdb.30.1338361375638;
\r
36 Wed, 30 May 2012 00:02:55 -0700 (PDT)
\r
37 Received: from nas.home.pioto.org (pool-71-182-155-97.pitbpa.fios.verizon.net.
\r
39 by mx.google.com with ESMTPS id d20sm28307480vde.20.2012.05.30.00.02.54
\r
40 (version=TLSv1/SSLv3 cipher=OTHER);
\r
41 Wed, 30 May 2012 00:02:55 -0700 (PDT)
\r
42 Received: by nas.home.pioto.org (Postfix, from userid 1001)
\r
43 id 086F8287DC; Wed, 30 May 2012 03:02:53 -0400 (EDT)
\r
44 From: Mike Kelly <pioto@pioto.org>
\r
45 To: notmuch@notmuchmail.org
\r
46 Subject: [PATCH v2 7/9] test/count: fix numeric comparision tests on FreeBSD
\r
47 Date: Wed, 30 May 2012 03:02:02 -0400
\r
48 Message-Id: <1338361324-57289-8-git-send-email-pioto@pioto.org>
\r
49 X-Mailer: git-send-email 1.7.10.2
\r
50 In-Reply-To: <1338361324-57289-1-git-send-email-pioto@pioto.org>
\r
51 References: <1338361324-57289-1-git-send-email-pioto@pioto.org>
\r
53 ALoCoQkXkPhyqBsZjex6ilBNRQykMsV/8h+cHpY3cACUC/1zxaQL6iKuPLkLKpYNFDJVFigN/8q0
\r
54 X-BeenThere: notmuch@notmuchmail.org
\r
55 X-Mailman-Version: 2.1.13
\r
57 List-Id: "Use and development of the notmuch mail system."
\r
58 <notmuch.notmuchmail.org>
\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
62 List-Post: <mailto:notmuch@notmuchmail.org>
\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
66 X-List-Received-Date: Wed, 30 May 2012 07:02:59 -0000
\r
68 FreeBSD's `wc -l` includes some white space in front of the number.
\r
69 Instead, we add a test_expect_equal_num() to test-lib.sh, which ensures
\r
70 we do a proper numeric comparision, and in a portable way.
\r
72 test/count | 8 ++++----
\r
73 test/test-lib.sh | 22 ++++++++++++++++++++++
\r
74 2 files changed, 26 insertions(+), 4 deletions(-)
\r
76 diff --git a/test/count b/test/count
\r
77 index 300b171..902c7c6 100755
\r
80 @@ -7,22 +7,22 @@ add_email_corpus
\r
83 test_begin_subtest "message count is the default for notmuch count"
\r
84 -test_expect_equal \
\r
85 +test_expect_equal_num \
\r
86 "`notmuch search --output=messages ${SEARCH} | wc -l`" \
\r
87 "`notmuch count ${SEARCH}`"
\r
89 test_begin_subtest "message count with --output=messages"
\r
90 -test_expect_equal \
\r
91 +test_expect_equal_num \
\r
92 "`notmuch search --output=messages ${SEARCH} | wc -l`" \
\r
93 "`notmuch count --output=messages ${SEARCH}`"
\r
95 test_begin_subtest "thread count with --output=threads"
\r
96 -test_expect_equal \
\r
97 +test_expect_equal_num \
\r
98 "`notmuch search --output=threads ${SEARCH} | wc -l`" \
\r
99 "`notmuch count --output=threads ${SEARCH}`"
\r
101 test_begin_subtest "thread count is the default for notmuch search"
\r
102 -test_expect_equal \
\r
103 +test_expect_equal_num \
\r
104 "`notmuch search ${SEARCH} | wc -l`" \
\r
105 "`notmuch count --output=threads ${SEARCH}`"
\r
107 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
108 index da792b7..2ac92f7 100644
\r
109 --- a/test/test-lib.sh
\r
110 +++ b/test/test-lib.sh
\r
111 @@ -512,6 +512,28 @@ test_expect_equal_file ()
\r
115 +# Like test_expect_equal, but does a numeric comparision instead of a
\r
116 +# string comparision
\r
117 +test_expect_equal_num () {
\r
118 + exec 1>&6 2>&7 # Restore stdout and stderr
\r
120 + test "$#" = 3 && { prereq=$1; shift; } || prereq=
\r
122 + error "bug in the test script: not 2 or 3 parameters to test_expect_equal"
\r
126 + if ! test_skip "$test_subtest_name"
\r
128 + if test "$output" -eq "$expected"
\r
130 + test_ok_ "$test_subtest_name"
\r
132 + test_failure_ "$test_subtest_name" "$output != $expected"
\r
137 test_emacs_expect_t () {
\r
138 test "$#" = 2 && { prereq=$1; shift; } || prereq=
\r