From: Jani Nikula Date: Sun, 9 Mar 2014 21:40:23 +0000 (+0200) Subject: [PATCH v4 02/13] test: add notmuch_search_files_sanitize and use it X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0a09c248bdddb870ffbc8d699192e326a2381e5b;p=notmuch-archives.git [PATCH v4 02/13] test: add notmuch_search_files_sanitize and use it --- diff --git a/b4/a80efb1533fbaddcfde88762d902073a136c14 b/b4/a80efb1533fbaddcfde88762d902073a136c14 new file mode 100644 index 000000000..9e65d1252 --- /dev/null +++ b/b4/a80efb1533fbaddcfde88762d902073a136c14 @@ -0,0 +1,149 @@ +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 178E9431FD4 + for ; Sun, 9 Mar 2014 14:40:53 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 DC51qVZsvQOd for ; + Sun, 9 Mar 2014 14:40:47 -0700 (PDT) +Received: from mail-la0-f51.google.com (mail-la0-f51.google.com + [209.85.215.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 01C44431FBF + for ; Sun, 9 Mar 2014 14:40:43 -0700 (PDT) +Received: by mail-la0-f51.google.com with SMTP id pv20so4198472lab.10 + for ; Sun, 09 Mar 2014 14:40:42 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references:in-reply-to:references; + bh=d6GR0LirnAVAxtTU6YtVs/HNI5kyL6pbfPn8e8nmxM0=; + b=EsYpmEnPixrc9pdT/EiOyzyEvhJ4PGjAoJdtqnhPc0vpXYp0VGQfBywykEIiAJGVvU + Hy0AbCJr32a0v/ASReowV3evjSNMBN1DaSWWh2H+YduvEGUHcZJQ3ITM+atx8bRZSe0M + sZPdIgUcSAR3pT7Rf9eJxpu2U8G0KefmyXDfvS2UjoQHm2Pl3dYabfO3eM0K2tUfM0CW + i6k1BMiK2cuDbwYPdun3gqUrq4jlkD8toP8QyfY5HAAHD0bp/5yP4jjcmoAjAEMfaeUC + 8oALpJc+Obp5Rv78xuIfPOi9Qumpua2A46x1MdvmJEg08d1yzSrHcD8LhDlfH+J05GBQ + IR7Q== +X-Gm-Message-State: + ALoCoQmnsdyNETv93HlTnoYqdjQZ9gmydtoZ3pjdURcKVs9LK/QtM/tRoi1/bkKas1cFebpo7m+C +X-Received: by 10.112.142.161 with SMTP id rx1mr19576530lbb.33.1394401242370; + Sun, 09 Mar 2014 14:40:42 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) + by mx.google.com with ESMTPSA id zf7sm26924610lab.7.2014.03.09.14.40.41 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sun, 09 Mar 2014 14:40:41 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH v4 02/13] test: add notmuch_search_files_sanitize and use it +Date: Sun, 9 Mar 2014 23:40:23 +0200 +Message-Id: + <081062d057f54fcc6dcb5e5d03808a361960bf90.1394400503.git.jani@nikula.org> +X-Mailer: git-send-email 1.9.0 +In-Reply-To: +References: +In-Reply-To: +References: +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: Sun, 09 Mar 2014 21:40:53 -0000 + +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 ef28c3d157aa..e0bf8c16aecb 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 3f6ec76348c0..5e72a6ccfd3a 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 66edb7c99f24..837c669ee757 100644 +--- a/test/test-lib.sh ++++ b/test/test-lib.sh +@@ -661,6 +661,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.9.0 +