[PATCH 2/3] test: wrap 'wc -l' results in arithmetic evaluation to strip whitespace
authorJani Nikula <jani@nikula.org>
Tue, 4 Dec 2012 21:26:32 +0000 (23:26 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:29 +0000 (09:51 -0800)
f5/1adbc9da21c8936cbd6ed02b7b8323e2011cb0 [new file with mode: 0644]

diff --git a/f5/1adbc9da21c8936cbd6ed02b7b8323e2011cb0 b/f5/1adbc9da21c8936cbd6ed02b7b8323e2011cb0
new file mode 100644 (file)
index 0000000..24fcae1
--- /dev/null
@@ -0,0 +1,119 @@
+Return-Path: <jani@nikula.org>\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 6F4B4431FAE\r
+       for <notmuch@notmuchmail.org>; Tue,  4 Dec 2012 13:26:57 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[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 ysbysM4gv3xS for <notmuch@notmuchmail.org>;\r
+       Tue,  4 Dec 2012 13:26:53 -0800 (PST)\r
+Received: from mail-la0-f53.google.com (mail-la0-f53.google.com\r
+       [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 3AEDF431FDE\r
+       for <notmuch@notmuchmail.org>; Tue,  4 Dec 2012 13:26:45 -0800 (PST)\r
+Received: by mail-la0-f53.google.com with SMTP id w12so3787110lag.26\r
+       for <notmuch@notmuchmail.org>; Tue, 04 Dec 2012 13:26:43 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+       :in-reply-to:references:x-gm-message-state;\r
+       bh=RxUHeQW3VuU2eKDL4ZL1LSHCtD344lesDvEg/JURyX0=;\r
+       b=TPiFhx+DH13jeRv/WbuDobmxPXtUlT3hPBaxB9vcfNn+8pFZnHSjc9XvRqCJdP7bjg\r
+       oKM6GSziUlhHoPEWbDkDW7ZOYKPKXbS+b8FrL2bK98qiNSZ+3ckuqe8b3ztwqUnOrWAc\r
+       c80NmHmSAKXJZK+GhSaiuaqWzJFvySpFzV1/cwTgQCy+wtJOX0GLSHS2dgDF9KYpvX0m\r
+       Z/ubHcp7OblLV0gxYF+S6hijA9BkBX2/I6Se0b2n/GE4gSr3l/VcU0qiCr3WTuHW6g72\r
+       FhStqf1NuchFbWCJTk3901ai5krpqyjT45CpxUPyaxmshRwm4mWLOt7taknezFqYXGul\r
+       XXVw==\r
+Received: by 10.152.125.7 with SMTP id mm7mr1727220lab.2.1354656403659;\r
+       Tue, 04 Dec 2012 13:26:43 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id so7sm1195821lab.0.2012.12.04.13.26.42\r
+       (version=SSLv3 cipher=OTHER); Tue, 04 Dec 2012 13:26:42 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/3] test: wrap 'wc -l' results in arithmetic evaluation to\r
+       strip whitespace\r
+Date: Tue,  4 Dec 2012 23:26:32 +0200\r
+Message-Id:\r
+ <34cf9a648edbee52377eaaddc949f20a4defe4f9.1354656085.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <cover.1354656085.git.jani@nikula.org>\r
+References: <cover.1354656085.git.jani@nikula.org>\r
+In-Reply-To: <cover.1354656085.git.jani@nikula.org>\r
+References: <cover.1354656085.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQng1eQBFc2h2wFyB1jxiattFEA5AAoVq1l+TjAXO3ccRDBiDf0clWQiGjIapvWliru4jei0\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: Tue, 04 Dec 2012 21:26:57 -0000\r
+\r
+This is for portability, as 'wc -l' emits whitespace on some BSD\r
+variants. Suggested by Tomi Ollila <tomi.ollila@iki.fi>.\r
+\r
+---\r
+\r
+Updated version of id:1338361324-57289-8-git-send-email-pioto@pioto.org\r
+---\r
+ test/count |   12 ++++++++----\r
+ 1 file changed, 8 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/test/count b/test/count\r
+index 8e587ff..879b114 100755\r
+--- a/test/count\r
++++ b/test/count\r
+@@ -4,24 +4,28 @@ test_description='"notmuch count" for messages and threads'\r
\r
+ add_email_corpus\r
\r
++# Note: The 'wc -l' results below are wrapped in arithmetic evaluation\r
++# $((...)) to strip whitespace. This is for portability, as 'wc -l'\r
++# emits whitespace on some BSD variants.\r
++\r
+ test_begin_subtest "message count is the default for notmuch count"\r
+ test_expect_equal \\r
+-    "`notmuch search --output=messages '*' | wc -l`" \\r
++    "$((`notmuch search --output=messages '*' | wc -l`))" \\r
+     "`notmuch count '*'`"\r
\r
+ test_begin_subtest "message count with --output=messages"\r
+ test_expect_equal \\r
+-    "`notmuch search --output=messages '*' | wc -l`" \\r
++    "$((`notmuch search --output=messages '*' | wc -l`))" \\r
+     "`notmuch count --output=messages '*'`"\r
\r
+ test_begin_subtest "thread count with --output=threads"\r
+ test_expect_equal \\r
+-    "`notmuch search --output=threads '*' | wc -l`" \\r
++    "$((`notmuch search --output=threads '*' | wc -l`))" \\r
+     "`notmuch count --output=threads '*'`"\r
\r
+ test_begin_subtest "thread count is the default for notmuch search"\r
+ test_expect_equal \\r
+-    "`notmuch search '*' | wc -l`" \\r
++    "$((`notmuch search '*' | wc -l`))" \\r
+     "`notmuch count --output=threads '*'`"\r
\r
+ test_begin_subtest "count with no matching messages"\r
+-- \r
+1.7.10.4\r
+\r