* [PATCH] test: refactor directory name sanitization
@ 2016-01-23 12:49 David Bremner
2016-01-23 16:33 ` Tomi Ollila
2016-01-29 11:40 ` David Bremner
0 siblings, 2 replies; 3+ messages in thread
From: David Bremner @ 2016-01-23 12:49 UTC (permalink / raw)
To: notmuch
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 | 2 +-
test/test-lib.sh | 11 ++++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index c280939..59a479c 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 0c9b366..c8f14d9 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -684,9 +684,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,'
@@ -1186,7 +1191,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
}
--
2.6.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] test: refactor directory name sanitization
2016-01-23 12:49 [PATCH] test: refactor directory name sanitization David Bremner
@ 2016-01-23 16:33 ` Tomi Ollila
2016-01-29 11:40 ` David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: Tomi Ollila @ 2016-01-23 16:33 UTC (permalink / raw)
To: David Bremner, notmuch
On Sat, Jan 23 2016, David Bremner <david@tethera.net> wrote:
> 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 | 2 +-
> test/test-lib.sh | 11 ++++++++---
> 2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
> index c280939..59a479c 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 0c9b366..c8f14d9 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -684,9 +684,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" "$@"
Looks good, ^^ \ but 2 spaces there
> }
>
> NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'
> @@ -1186,7 +1191,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
Ditto, although this was th^^ere before, but now these 2 could be amended.
BTW: I trust you tested. I did not.
Tomi
BTW2: MAIL_DIR is based on user's current CWD(*) -- if that contains commas
(,) then things will break ;/
(*) +++(./test-lib-common.sh:148): MAIL_DIR=/home/user/vc/ext/notmuch/test/tmp.test-verbose/mail
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] test: refactor directory name sanitization
2016-01-23 12:49 [PATCH] test: refactor directory name sanitization David Bremner
2016-01-23 16:33 ` Tomi Ollila
@ 2016-01-29 11:40 ` David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2016-01-29 11:40 UTC (permalink / raw)
To: notmuch
David Bremner <david@tethera.net> writes:
> test_C and notmuch_search_files_sanitize were giving different output on
> the same path, which is not technically wrong, but slightly
> confusing.
pushed, amended per Tomi's eagle eye for whitespace.
d
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-29 11:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-23 12:49 [PATCH] test: refactor directory name sanitization David Bremner
2016-01-23 16:33 ` Tomi Ollila
2016-01-29 11:40 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).