mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-02-17 23:53:15 +01:00
test: add notmuch_search_files_sanitize and use it
We do this in a lot of places, so make it a helper in the test-lib.
This commit is contained in:
parent
8c37821a0d
commit
7630f300ba
3 changed files with 10 additions and 5 deletions
|
@ -181,7 +181,7 @@ EOF
|
||||||
test_expect_equal_file OUTPUT EXPECTED
|
test_expect_equal_file OUTPUT EXPECTED
|
||||||
|
|
||||||
test_begin_subtest "--output=files"
|
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
|
cat <<EOF >EXPECTED
|
||||||
MAIL_DIR/cur/52:2,
|
MAIL_DIR/cur/52:2,
|
||||||
MAIL_DIR/cur/53:2,
|
MAIL_DIR/cur/53:2,
|
||||||
|
@ -240,7 +240,7 @@ EOF
|
||||||
test_expect_equal_file OUTPUT EXPECTED
|
test_expect_equal_file OUTPUT EXPECTED
|
||||||
|
|
||||||
test_begin_subtest "--output=files --duplicate=1"
|
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
|
cat <<EOF >EXPECTED
|
||||||
MAIL_DIR/cur/52:2,
|
MAIL_DIR/cur/52:2,
|
||||||
MAIL_DIR/cur/53:2,
|
MAIL_DIR/cur/53:2,
|
||||||
|
@ -298,7 +298,7 @@ EOF
|
||||||
test_expect_equal_file OUTPUT EXPECTED
|
test_expect_equal_file OUTPUT EXPECTED
|
||||||
|
|
||||||
test_begin_subtest "--output=files --format=json"
|
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
|
cat <<EOF >EXPECTED
|
||||||
["MAIL_DIR/cur/52:2,",
|
["MAIL_DIR/cur/52:2,",
|
||||||
"MAIL_DIR/cur/53:2,",
|
"MAIL_DIR/cur/53:2,",
|
||||||
|
@ -357,7 +357,7 @@ EOF
|
||||||
test_expect_equal_file OUTPUT EXPECTED
|
test_expect_equal_file OUTPUT EXPECTED
|
||||||
|
|
||||||
test_begin_subtest "--output=files --format=json --duplicate=2"
|
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
|
cat <<EOF >EXPECTED
|
||||||
["MAIL_DIR/cur/51:2,"]
|
["MAIL_DIR/cur/51:2,"]
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -27,7 +27,7 @@ cat <<EOF >EXPECTED
|
||||||
MAIL_DIR/msg-001
|
MAIL_DIR/msg-001
|
||||||
MAIL_DIR/spam/msg-001
|
MAIL_DIR/spam/msg-001
|
||||||
EOF
|
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_expect_equal_file OUTPUT EXPECTED
|
||||||
|
|
||||||
test_begin_subtest "Test matches folder:spam"
|
test_begin_subtest "Test matches folder:spam"
|
||||||
|
|
|
@ -667,6 +667,11 @@ notmuch_search_sanitize ()
|
||||||
perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'
|
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_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'
|
||||||
notmuch_show_sanitize ()
|
notmuch_show_sanitize ()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue