[PATCH v4 02/13] test: add notmuch_search_files_sanitize and use it
authorJani Nikula <jani@nikula.org>
Sun, 9 Mar 2014 21:40:23 +0000 (23:40 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:00:31 +0000 (10:00 -0800)
b4/a80efb1533fbaddcfde88762d902073a136c14 [new file with mode: 0644]

diff --git a/b4/a80efb1533fbaddcfde88762d902073a136c14 b/b4/a80efb1533fbaddcfde88762d902073a136c14
new file mode 100644 (file)
index 0000000..9e65d12
--- /dev/null
@@ -0,0 +1,149 @@
+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 178E9431FD4\r
+       for <notmuch@notmuchmail.org>; Sun,  9 Mar 2014 14:40:53 -0700 (PDT)\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 DC51qVZsvQOd for <notmuch@notmuchmail.org>;\r
+       Sun,  9 Mar 2014 14:40:47 -0700 (PDT)\r
+Received: from mail-la0-f51.google.com (mail-la0-f51.google.com\r
+       [209.85.215.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 01C44431FBF\r
+       for <notmuch@notmuchmail.org>; Sun,  9 Mar 2014 14:40:43 -0700 (PDT)\r
+Received: by mail-la0-f51.google.com with SMTP id pv20so4198472lab.10\r
+       for <notmuch@notmuchmail.org>; Sun, 09 Mar 2014 14:40:42 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+       :references:in-reply-to:references;\r
+       bh=d6GR0LirnAVAxtTU6YtVs/HNI5kyL6pbfPn8e8nmxM0=;\r
+       b=EsYpmEnPixrc9pdT/EiOyzyEvhJ4PGjAoJdtqnhPc0vpXYp0VGQfBywykEIiAJGVvU\r
+       Hy0AbCJr32a0v/ASReowV3evjSNMBN1DaSWWh2H+YduvEGUHcZJQ3ITM+atx8bRZSe0M\r
+       sZPdIgUcSAR3pT7Rf9eJxpu2U8G0KefmyXDfvS2UjoQHm2Pl3dYabfO3eM0K2tUfM0CW\r
+       i6k1BMiK2cuDbwYPdun3gqUrq4jlkD8toP8QyfY5HAAHD0bp/5yP4jjcmoAjAEMfaeUC\r
+       8oALpJc+Obp5Rv78xuIfPOi9Qumpua2A46x1MdvmJEg08d1yzSrHcD8LhDlfH+J05GBQ\r
+       IR7Q==\r
+X-Gm-Message-State:\r
+ ALoCoQmnsdyNETv93HlTnoYqdjQZ9gmydtoZ3pjdURcKVs9LK/QtM/tRoi1/bkKas1cFebpo7m+C\r
+X-Received: by 10.112.142.161 with SMTP id rx1mr19576530lbb.33.1394401242370; \r
+       Sun, 09 Mar 2014 14:40:42 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+       [88.195.111.91])\r
+       by mx.google.com with ESMTPSA id zf7sm26924610lab.7.2014.03.09.14.40.41\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sun, 09 Mar 2014 14:40:41 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 02/13] test: add notmuch_search_files_sanitize and use it\r
+Date: Sun,  9 Mar 2014 23:40:23 +0200\r
+Message-Id:\r
+ <081062d057f54fcc6dcb5e5d03808a361960bf90.1394400503.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.9.0\r
+In-Reply-To: <cover.1394400503.git.jani@nikula.org>\r
+References: <cover.1394400503.git.jani@nikula.org>\r
+In-Reply-To: <cover.1394400503.git.jani@nikula.org>\r
+References: <cover.1394400503.git.jani@nikula.org>\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: Sun, 09 Mar 2014 21:40:53 -0000\r
+\r
+We do this in a lot of places, so make it a helper in the test-lib.\r
+---\r
+ test/T090-search-output.sh           | 8 ++++----\r
+ test/T370-search-folder-coherence.sh | 2 +-\r
+ test/test-lib.sh                     | 5 +++++\r
+ 3 files changed, 10 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh\r
+index ef28c3d157aa..e0bf8c16aecb 100755\r
+--- a/test/T090-search-output.sh\r
++++ b/test/T090-search-output.sh\r
+@@ -181,7 +181,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
\r
+ test_begin_subtest "--output=files"\r
+-notmuch search --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT\r
++notmuch search --output=files '*' | notmuch_search_files_sanitize >OUTPUT\r
+ cat <<EOF >EXPECTED\r
+ MAIL_DIR/cur/52:2,\r
+ MAIL_DIR/cur/53:2,\r
+@@ -240,7 +240,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
\r
+ test_begin_subtest "--output=files --duplicate=1"\r
+-notmuch search --output=files --duplicate=1 '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT\r
++notmuch search --output=files --duplicate=1 '*' | notmuch_search_files_sanitize >OUTPUT\r
+ cat <<EOF >EXPECTED\r
+ MAIL_DIR/cur/52:2,\r
+ MAIL_DIR/cur/53:2,\r
+@@ -298,7 +298,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
\r
+ test_begin_subtest "--output=files --format=json"\r
+-notmuch search --format=json --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT\r
++notmuch search --format=json --output=files '*' | notmuch_search_files_sanitize >OUTPUT\r
+ cat <<EOF >EXPECTED\r
+ ["MAIL_DIR/cur/52:2,",\r
+ "MAIL_DIR/cur/53:2,",\r
+@@ -357,7 +357,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
\r
+ test_begin_subtest "--output=files --format=json --duplicate=2"\r
+-notmuch search --format=json --output=files --duplicate=2 '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT\r
++notmuch search --format=json --output=files --duplicate=2 '*' | notmuch_search_files_sanitize >OUTPUT\r
+ cat <<EOF >EXPECTED\r
+ ["MAIL_DIR/cur/51:2,"]\r
+ EOF\r
+diff --git a/test/T370-search-folder-coherence.sh b/test/T370-search-folder-coherence.sh\r
+index 3f6ec76348c0..5e72a6ccfd3a 100755\r
+--- a/test/T370-search-folder-coherence.sh\r
++++ b/test/T370-search-folder-coherence.sh\r
+@@ -27,7 +27,7 @@ cat <<EOF >EXPECTED\r
+ MAIL_DIR/msg-001\r
+ MAIL_DIR/spam/msg-001\r
+ EOF\r
+-notmuch search --output=files id:$id_x | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT\r
++notmuch search --output=files id:$id_x | notmuch_search_files_sanitize >OUTPUT\r
+ test_expect_equal_file OUTPUT EXPECTED\r
\r
+ test_begin_subtest "Test matches folder:spam"\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 66edb7c99f24..837c669ee757 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -661,6 +661,11 @@ notmuch_search_sanitize ()\r
+     perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'\r
+ }\r
\r
++notmuch_search_files_sanitize()\r
++{\r
++    sed -e "s,$MAIL_DIR,MAIL_DIR,"\r
++}\r
++\r
+ NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'\r
+ notmuch_show_sanitize ()\r
+ {\r
+-- \r
+1.9.0\r
+\r