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.
This commit is contained in:
David Bremner 2016-01-23 08:49:26 -04:00
parent 07b6220a55
commit 12534d5c4b
2 changed files with 9 additions and 4 deletions

View file

@ -183,7 +183,7 @@ int main (int argc, char** argv)
EOF EOF
cat <<'EOF' >EXPECTED cat <<'EOF' >EXPECTED
== stdout == == stdout ==
Path already exists: CWD/mail Path already exists: MAIL_DIR
== stderr == == stderr ==
EOF EOF

View file

@ -678,9 +678,14 @@ notmuch_search_sanitize ()
perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/' 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,' NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'
@ -1180,7 +1185,7 @@ test_C () {
echo "== stdout ==" > OUTPUT.stdout echo "== stdout ==" > OUTPUT.stdout
echo "== stderr ==" > OUTPUT.stderr echo "== stderr ==" > OUTPUT.stderr
./${exec_file} "$@" 1>>OUTPUT.stdout 2>>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
} }