]> git.cworth.org Git - notmuch/commitdiff
test: refactor directory name sanitization
authorDavid Bremner <david@tethera.net>
Sat, 23 Jan 2016 12:49:26 +0000 (08:49 -0400)
committerDavid Bremner <david@tethera.net>
Wed, 27 Jan 2016 02:50:58 +0000 (22:50 -0400)
test_C and notmuch_search_files_sanitize were giving different output on
the same path, which is not technically wrong, but slightly
confusing.

test/T560-lib-error.sh
test/test-lib.sh

index c280939c54fab4cc83e5aa29a09dbaf0342bdc41..59a479c849e998f16c7a08abd5d7b43ec83169a4 100755 (executable)
@@ -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
index 270c718b28539e10a55329a26c1f5319b1cd6198..6fe335b588996c1dc6af4d96fbe4a03c43ac0c85 100644 (file)
@@ -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
 }