From a3d319ccbc05c807b42095b91c4ed720cafcf141 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 12 Mar 2014 20:01:28 +2100 Subject: [PATCH] [Patch v6 02/14] test: add notmuch_search_files_sanitize and use it --- 8f/481d429aa58e35d31ab95c16d5b389d4f7c59e | 129 ++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 8f/481d429aa58e35d31ab95c16d5b389d4f7c59e diff --git a/8f/481d429aa58e35d31ab95c16d5b389d4f7c59e b/8f/481d429aa58e35d31ab95c16d5b389d4f7c59e new file mode 100644 index 000000000..3d21a7518 --- /dev/null +++ b/8f/481d429aa58e35d31ab95c16d5b389d4f7c59e @@ -0,0 +1,129 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 457ED431FD5 + for ; Tue, 11 Mar 2014 16:02:44 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ZnYbzCwrZlbu for ; + Tue, 11 Mar 2014 16:02:42 -0700 (PDT) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 5DC65431FBF + for ; Tue, 11 Mar 2014 16:02:28 -0700 (PDT) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1WNVgp-0001vt-Sc; Tue, 11 Mar 2014 20:02:27 -0300 +Received: (nullmailer pid 25843 invoked by uid 1000); Tue, 11 Mar 2014 + 23:01:45 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [Patch v6 02/14] test: add notmuch_search_files_sanitize and use it +Date: Tue, 11 Mar 2014 20:01:28 -0300 +Message-Id: <1394578900-25618-3-git-send-email-david@tethera.net> +X-Mailer: git-send-email 1.8.5.3 +In-Reply-To: <1394578900-25618-1-git-send-email-david@tethera.net> +References: <1394578900-25618-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 11 Mar 2014 23:02:44 -0000 + +From: Jani Nikula + +We do this in a lot of places, so make it a helper in the test-lib. +--- + test/T090-search-output.sh | 8 ++++---- + test/T370-search-folder-coherence.sh | 2 +- + test/test-lib.sh | 5 +++++ + 3 files changed, 10 insertions(+), 5 deletions(-) + +diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh +index 86544ac..a8ab920 100755 +--- a/test/T090-search-output.sh ++++ b/test/T090-search-output.sh +@@ -181,7 +181,7 @@ EOF + test_expect_equal_file OUTPUT EXPECTED + + test_begin_subtest "--output=files" +-notmuch search --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT ++notmuch search --output=files '*' | notmuch_search_files_sanitize >OUTPUT + cat <EXPECTED + MAIL_DIR/cur/52:2, + MAIL_DIR/cur/53:2, +@@ -240,7 +240,7 @@ EOF + test_expect_equal_file OUTPUT EXPECTED + + test_begin_subtest "--output=files --duplicate=1" +-notmuch search --output=files --duplicate=1 '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT ++notmuch search --output=files --duplicate=1 '*' | notmuch_search_files_sanitize >OUTPUT + cat <EXPECTED + MAIL_DIR/cur/52:2, + MAIL_DIR/cur/53:2, +@@ -298,7 +298,7 @@ EOF + test_expect_equal_file OUTPUT EXPECTED + + test_begin_subtest "--output=files --format=json" +-notmuch search --format=json --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT ++notmuch search --format=json --output=files '*' | notmuch_search_files_sanitize >OUTPUT + cat <EXPECTED + ["MAIL_DIR/cur/52:2,", + "MAIL_DIR/cur/53:2,", +@@ -357,7 +357,7 @@ EOF + test_expect_equal_file OUTPUT EXPECTED + + test_begin_subtest "--output=files --format=json --duplicate=2" +-notmuch search --format=json --output=files --duplicate=2 '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT ++notmuch search --format=json --output=files --duplicate=2 '*' | notmuch_search_files_sanitize >OUTPUT + cat <EXPECTED + ["MAIL_DIR/cur/51:2,"] + EOF +diff --git a/test/T370-search-folder-coherence.sh b/test/T370-search-folder-coherence.sh +index 3f6ec76..5e72a6c 100755 +--- a/test/T370-search-folder-coherence.sh ++++ b/test/T370-search-folder-coherence.sh +@@ -27,7 +27,7 @@ cat <EXPECTED + MAIL_DIR/msg-001 + MAIL_DIR/spam/msg-001 + EOF +-notmuch search --output=files id:$id_x | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT ++notmuch search --output=files id:$id_x | notmuch_search_files_sanitize >OUTPUT + test_expect_equal_file OUTPUT EXPECTED + + test_begin_subtest "Test matches folder:spam" +diff --git a/test/test-lib.sh b/test/test-lib.sh +index 9824bb6..8697d6a 100644 +--- a/test/test-lib.sh ++++ b/test/test-lib.sh +@@ -667,6 +667,11 @@ notmuch_search_sanitize () + perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/' + } + ++notmuch_search_files_sanitize() ++{ ++ sed -e "s,$MAIL_DIR,MAIL_DIR," ++} ++ + NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,' + notmuch_show_sanitize () + { +-- +1.8.5.3 + -- 2.26.2