aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2016-01-23 08:49:26 -0400
committerDavid Bremner <david@tethera.net>2016-01-26 22:50:58 -0400
commit12534d5c4b02498173b0c63d063ae0a3c845b957 (patch)
tree9fcdbb671743e73efbf42773d66d11397b618ec4
parent07b6220a5595bf4556e636709220121d6405e9e9 (diff)
test: refactor directory name sanitization
test_C and notmuch_search_files_sanitize were giving different output on the same path, which is not technically wrong, but slightly confusing.
-rwxr-xr-xtest/T560-lib-error.sh2
-rw-r--r--test/test-lib.sh11
2 files changed, 9 insertions, 4 deletions
diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index c280939c..59a479c8 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -183,7 +183,7 @@ int main (int argc, char** argv)
EOF
cat <<'EOF' >EXPECTED
== stdout ==
-Path already exists: CWD/mail
+Path already exists: MAIL_DIR
== stderr ==
EOF
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 270c718b..6fe335b5 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -678,9 +678,14 @@ notmuch_search_sanitize ()
perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'
}
-notmuch_search_files_sanitize()
+notmuch_search_files_sanitize ()
{
- sed -e "s,$MAIL_DIR,MAIL_DIR,"
+ notmuch_dir_sanitize
+}
+
+notmuch_dir_sanitize ()
+{
+ sed -e "s,$MAIL_DIR,MAIL_DIR," -e "s,${PWD},CWD,g" "$@"
}
NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'
@@ -1180,7 +1185,7 @@ test_C () {
echo "== stdout ==" > OUTPUT.stdout
echo "== stderr ==" > OUTPUT.stderr
./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr
- sed "s,${PWD},CWD,g" OUTPUT.stdout OUTPUT.stderr > OUTPUT
+ notmuch_dir_sanitize OUTPUT.stdout OUTPUT.stderr > OUTPUT
}