[PATCH v4 02/13] test: add notmuch_search_files_sanitize and use it
Jani Nikula
jani at nikula.org
Sun Mar 9 14:40:23 PDT 2014
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 <<EOF >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 <<EOF >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 <<EOF >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 <<EOF >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 <<EOF >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
More information about the notmuch
mailing list