[PATCH] test: refactor directory name sanitization
authorDavid Bremner <david@tethera.net>
Sat, 23 Jan 2016 12:49:26 +0000 (08:49 +2000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:20:55 +0000 (16:20 -0700)
dc/0d681202f902b251e73aa00f47ec3a4f27fc0a [new file with mode: 0644]

diff --git a/dc/0d681202f902b251e73aa00f47ec3a4f27fc0a b/dc/0d681202f902b251e73aa00f47ec3a4f27fc0a
new file mode 100644 (file)
index 0000000..0bb1bbc
--- /dev/null
@@ -0,0 +1,98 @@
+Return-Path: <bremner@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id A3C666DE0B2F\r
+ for <notmuch@notmuchmail.org>; Sat, 23 Jan 2016 04:49:42 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.309\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.309 tagged_above=-999 required=5 tests=[AWL=0.242,\r
+  RP_MATCHES_RCVD=-0.55, SPF_PASS=-0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id xQ0AP3w5HxVg for <notmuch@notmuchmail.org>;\r
+ Sat, 23 Jan 2016 04:49:40 -0800 (PST)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id C8AB16DE0217\r
+ for <notmuch@notmuchmail.org>; Sat, 23 Jan 2016 04:49:40 -0800 (PST)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1aMxcg-0007xW-TJ; Sat, 23 Jan 2016 07:48:58 -0500\r
+Received: (nullmailer pid 7655 invoked by uid 1000);\r
+ Sat, 23 Jan 2016 12:49:35 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] test: refactor directory name sanitization\r
+Date: Sat, 23 Jan 2016 08:49:26 -0400\r
+Message-Id: <1453553366-7454-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.6.4\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 23 Jan 2016 12:49:42 -0000\r
+\r
+test_C and notmuch_search_files_sanitize were giving different output on\r
+the same path, which is not technically wrong, but slightly\r
+confusing.\r
+---\r
+ test/T560-lib-error.sh |  2 +-\r
+ test/test-lib.sh       | 11 ++++++++---\r
+ 2 files changed, 9 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh\r
+index c280939..59a479c 100755\r
+--- a/test/T560-lib-error.sh\r
++++ b/test/T560-lib-error.sh\r
+@@ -183,7 +183,7 @@ int main (int argc, char** argv)\r
+ EOF\r
+ cat <<'EOF' >EXPECTED\r
+ == stdout ==\r
+-Path already exists: CWD/mail\r
++Path already exists: MAIL_DIR\r
\r
+ == stderr ==\r
+ EOF\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 0c9b366..c8f14d9 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -684,9 +684,14 @@ notmuch_search_sanitize ()\r
+     perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'\r
+ }\r
\r
+-notmuch_search_files_sanitize()\r
++notmuch_search_files_sanitize ()\r
+ {\r
+-    sed -e "s,$MAIL_DIR,MAIL_DIR,"\r
++    notmuch_dir_sanitize\r
++}\r
++\r
++notmuch_dir_sanitize ()\r
++{\r
++    sed -e  "s,$MAIL_DIR,MAIL_DIR," -e "s,${PWD},CWD,g" "$@"\r
+ }\r
\r
+ NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'\r
+@@ -1186,7 +1191,7 @@ test_C () {\r
+     echo "== stdout ==" > OUTPUT.stdout\r
+     echo "== stderr ==" > OUTPUT.stderr\r
+     ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr\r
+-    sed "s,${PWD},CWD,g"  OUTPUT.stdout OUTPUT.stderr > OUTPUT\r
++    notmuch_dir_sanitize  OUTPUT.stdout OUTPUT.stderr > OUTPUT\r
+ }\r
\r
\r
+-- \r
+2.6.4\r
+\r