[RFC PATCH v5 09/11] test: update tests to reflect the exclude flag
Austin Clements
amdragon at MIT.EDU
Fri Feb 24 15:47:10 PST 2012
Did you mean to put this one right after the show format update,
rather than having the man update between the two? (I would argue
that this should go in the same patch as the show format update so
that the tests never fail, but people seem to disagree about this.)
Quoth Mark Walters on Feb 15 at 9:03 am:
> notmuch show outputs the exclude flag so many tests using notmuch
> show failed. This commit adds "excluded:0" or "excluded: false" to
> the expected outputs. After this commit there should be no failing
> tests.
> ---
> test/crypto | 9 ++++++++-
> test/encoding | 2 +-
> test/json | 6 +++---
> test/maildir-sync | 1 +
> test/multipart | 4 ++--
> test/thread-naming | 16 ++++++++--------
> 6 files changed, 23 insertions(+), 15 deletions(-)
>
> diff --git a/test/crypto b/test/crypto
> index 1dbb60a..564cf9a 100755
> --- a/test/crypto
> +++ b/test/crypto
> @@ -43,6 +43,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \
> | sed -e 's|"created": [1234567890]*|"created": 946728000|')
> expected='[[[{"id": "XXXXX",
> "match": true,
> + "excluded": false,
> "filename": "YYYYY",
> "timestamp": 946728000,
> "date_relative": "2000-01-01",
> @@ -77,6 +78,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \
> | sed -e 's|"created": [1234567890]*|"created": 946728000|')
> expected='[[[{"id": "XXXXX",
> "match": true,
> + "excluded": false,
> "filename": "YYYYY",
> "timestamp": 946728000,
> "date_relative": "2000-01-01",
> @@ -113,6 +115,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \
> | sed -e 's|"created": [1234567890]*|"created": 946728000|')
> expected='[[[{"id": "XXXXX",
> "match": true,
> + "excluded": false,
> "filename": "YYYYY",
> "timestamp": 946728000,
> "date_relative": "2000-01-01",
> @@ -153,7 +156,7 @@ test_begin_subtest "decryption, --format=text"
> output=$(notmuch show --format=text --decrypt subject:"test encrypted message 001" \
> | notmuch_show_sanitize_all \
> | sed -e 's|"created": [1234567890]*|"created": 946728000|')
> -expected='message{ id:XXXXX depth:0 match:1 filename:XXXXX
> +expected='message{ id:XXXXX depth:0 match:1 excluded:0 filename:XXXXX
> header{
> Notmuch Test Suite <test_suite at notmuchmail.org> (2000-01-01) (encrypted inbox)
> Subject: test encrypted message 001
> @@ -187,6 +190,7 @@ output=$(notmuch show --format=json --decrypt subject:"test encrypted message 00
> | sed -e 's|"created": [1234567890]*|"created": 946728000|')
> expected='[[[{"id": "XXXXX",
> "match": true,
> + "excluded": false,
> "filename": "YYYYY",
> "timestamp": 946728000,
> "date_relative": "2000-01-01",
> @@ -242,6 +246,7 @@ output=$(notmuch show --format=json --decrypt subject:"test encrypted message 00
> | sed -e 's|"created": [1234567890]*|"created": 946728000|')
> expected='[[[{"id": "XXXXX",
> "match": true,
> + "excluded": false,
> "filename": "YYYYY",
> "timestamp": 946728000,
> "date_relative": "2000-01-01",
> @@ -277,6 +282,7 @@ output=$(notmuch show --format=json --decrypt subject:"test encrypted message 00
> | sed -e 's|"created": [1234567890]*|"created": 946728000|')
> expected='[[[{"id": "XXXXX",
> "match": true,
> + "excluded": false,
> "filename": "YYYYY",
> "timestamp": 946728000,
> "date_relative": "2000-01-01",
> @@ -332,6 +338,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \
> | sed -e 's|"created": [1234567890]*|"created": 946728000|')
> expected='[[[{"id": "XXXXX",
> "match": true,
> + "excluded": false,
> "filename": "YYYYY",
> "timestamp": 946728000,
> "date_relative": "2000-01-01",
> diff --git a/test/encoding b/test/encoding
> index 33259c1..a872345 100755
> --- a/test/encoding
> +++ b/test/encoding
> @@ -6,7 +6,7 @@ test_begin_subtest "Message with text of unknown charset"
> add_message '[content-type]="text/plain; charset=unknown-8bit"' \
> "[body]=irrelevant"
> output=$(notmuch show id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
> -test_expect_equal "$output" "message{ id:msg-001 at notmuch-test-suite depth:0 match:1 filename:/XXX/mail/msg-001
> +test_expect_equal "$output" "message{ id:msg-001 at notmuch-test-suite depth:0 match:1 excluded:0 filename:/XXX/mail/msg-001
> header{
> Notmuch Test Suite <test_suite at notmuchmail.org> (2001-01-05) (inbox unread)
> Subject: Test message #1
> diff --git a/test/json b/test/json
> index 7df4380..f95fcf8 100755
> --- a/test/json
> +++ b/test/json
> @@ -5,7 +5,7 @@ test_description="--format=json output"
> test_begin_subtest "Show message: json"
> add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-show-message\""
> output=$(notmuch show --format=json "json-show-message")
> -test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Cc\": \"\", \"Bcc\": \"\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 -0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
> +test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Cc\": \"\", \"Bcc\": \"\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 -0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
>
> test_begin_subtest "Search message: json"
> add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-search-message\""
> @@ -22,7 +22,7 @@ test_expect_equal "$output" "[{\"thread\": \"XXX\",
> test_begin_subtest "Show message: json, utf-8"
> add_message "[subject]=\"json-show-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-show-méssage\""
> output=$(notmuch show --format=json "jsön-show-méssage")
> -test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Cc\": \"\", \"Bcc\": \"\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 -0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]"
> +test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Cc\": \"\", \"Bcc\": \"\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 -0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]"
>
> test_begin_subtest "Show message: json, inline attachment filename"
> subject='json-show-inline-attachment-filename'
> @@ -35,7 +35,7 @@ emacs_deliver_message \
> (insert \"Message-ID: <$id>\n\")"
> output=$(notmuch show --format=json "id:$id")
> filename=$(notmuch search --output=files "id:$id")
> -test_expect_equal "$output" "[[[{\"id\": \"$id\", \"match\": true, \"filename\": \"$filename\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"test_suite at notmuchmail.org\", \"Cc\": \"\", \"Bcc\": \"\", \"Date\": \"01 Jan 2000 12:00:00 -0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"filename\": \"README\"}]}]}, []]]]"
> +test_expect_equal "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": \"$filename\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"test_suite at notmuchmail.org\", \"Cc\": \"\", \"Bcc\": \"\", \"Date\": \"01 Jan 2000 12:00:00 -0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"filename\": \"README\"}]}]}, []]]]"
>
> test_begin_subtest "Search message: json, utf-8"
> add_message "[subject]=\"json-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\""
> diff --git a/test/maildir-sync b/test/maildir-sync
> index d5872a5..dfa3966 100755
> --- a/test/maildir-sync
> +++ b/test/maildir-sync
> @@ -46,6 +46,7 @@ test_begin_subtest "notmuch show works with renamed file (without notmuch new)"
> output=$(notmuch show --format=json id:${gen_msg_id} | filter_show_json)
> test_expect_equal "$output" '[[[{"id": "adding-replied-tag at notmuch-test-suite",
> "match": true,
> +"excluded": false,
> "filename": "MAIL_DIR/cur/adding-replied-tag:2,RS",
> "timestamp": 978709437,
> "date_relative": "2001-01-05",
> diff --git a/test/multipart b/test/multipart
> index 2dd73f5..3d2dcfc 100755
> --- a/test/multipart
> +++ b/test/multipart
> @@ -108,7 +108,7 @@ notmuch new > /dev/null
> test_begin_subtest "--format=text --part=0, full message"
> notmuch show --format=text --part=0 'id:87liy5ap00.fsf at yoom.home.cworth.org' >OUTPUT
> cat <<EOF >EXPECTED
> -message{ id:87liy5ap00.fsf at yoom.home.cworth.org depth:0 match:1 filename:${MAIL_DIR}/multipart
> +message{ id:87liy5ap00.fsf at yoom.home.cworth.org depth:0 match:1 excluded:0 filename:${MAIL_DIR}/multipart
> header{
> Carl Worth <cworth at cworth.org> (2001-01-05) (attachment inbox signed unread)
> Subject: Multipart message
> @@ -322,7 +322,7 @@ notmuch show --format=json --part=0 'id:87liy5ap00.fsf at yoom.home.cworth.org' | s
> echo >>OUTPUT # expect *no* newline at end of output
> cat <<EOF >EXPECTED
>
> -{"id": "87liy5ap00.fsf at yoom.home.cworth.org", "match": true, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth at cworth.org>", "To": "cworth at cworth.org", "Cc": "", "Bcc": "", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [
> +{"id": "87liy5ap00.fsf at yoom.home.cworth.org", "match": true, "excluded": false, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth at cworth.org>", "To": "cworth at cworth.org", "Cc": "", "Bcc": "", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [
> {"id": 1, "content-type": "multipart/signed", "content": [
> {"id": 2, "content-type": "multipart/mixed", "content": [
> {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"From": "Carl Worth <cworth at cworth.org>", "To": "cworth at cworth.org", "Subject": "html message", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [
> diff --git a/test/thread-naming b/test/thread-naming
> index 942e593..1a1a48f 100755
> --- a/test/thread-naming
> +++ b/test/thread-naming
> @@ -65,7 +65,7 @@ test_expect_equal "$output" "thread:XXX 2001-01-12 [6/8] Notmuch Test Suite; t
>
> test_begin_subtest 'Test order of messages in "notmuch show"'
> output=$(notmuch show thread-naming | notmuch_show_sanitize)
> -test_expect_equal "$output" "message{ id:msg-$(printf "%03d" $first)@notmuch-test-suite depth:0 match:1 filename:/XXX/mail/msg-$(printf "%03d" $first)
> +test_expect_equal "$output" "message{ id:msg-$(printf "%03d" $first)@notmuch-test-suite depth:0 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $first)
> header{
> Notmuch Test Suite <test_suite at notmuchmail.org> (2001-01-05) (unread)
> Subject: thread-naming: Initial thread subject
> @@ -79,7 +79,7 @@ This is just a test message (#$first)
> part}
> body}
> message}
> -message{ id:msg-$(printf "%03d" $((first + 1)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 1)))
> +message{ id:msg-$(printf "%03d" $((first + 1)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 1)))
> header{
> Notmuch Test Suite <test_suite at notmuchmail.org> (2001-01-06) (inbox unread)
> Subject: thread-naming: Older changed subject
> @@ -93,7 +93,7 @@ This is just a test message (#$((first + 1)))
> part}
> body}
> message}
> -message{ id:msg-$(printf "%03d" $((first + 2)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 2)))
> +message{ id:msg-$(printf "%03d" $((first + 2)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 2)))
> header{
> Notmuch Test Suite <test_suite at notmuchmail.org> (2001-01-07) (inbox unread)
> Subject: thread-naming: Newer changed subject
> @@ -107,7 +107,7 @@ This is just a test message (#$((first + 2)))
> part}
> body}
> message}
> -message{ id:msg-$(printf "%03d" $((first + 3)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 3)))
> +message{ id:msg-$(printf "%03d" $((first + 3)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 3)))
> header{
> Notmuch Test Suite <test_suite at notmuchmail.org> (2001-01-08) (unread)
> Subject: thread-naming: Final thread subject
> @@ -121,7 +121,7 @@ This is just a test message (#$((first + 3)))
> part}
> body}
> message}
> -message{ id:msg-$(printf "%03d" $((first + 4)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 4)))
> +message{ id:msg-$(printf "%03d" $((first + 4)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 4)))
> header{
> Notmuch Test Suite <test_suite at notmuchmail.org> (2001-01-09) (inbox unread)
> Subject: Re: thread-naming: Initial thread subject
> @@ -135,7 +135,7 @@ This is just a test message (#$((first + 4)))
> part}
> body}
> message}
> -message{ id:msg-$(printf "%03d" $((first + 5)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 5)))
> +message{ id:msg-$(printf "%03d" $((first + 5)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 5)))
> header{
> Notmuch Test Suite <test_suite at notmuchmail.org> (2001-01-10) (inbox unread)
> Subject: Aw: thread-naming: Initial thread subject
> @@ -149,7 +149,7 @@ This is just a test message (#$((first + 5)))
> part}
> body}
> message}
> -message{ id:msg-$(printf "%03d" $((first + 6)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 6)))
> +message{ id:msg-$(printf "%03d" $((first + 6)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 6)))
> header{
> Notmuch Test Suite <test_suite at notmuchmail.org> (2001-01-11) (inbox unread)
> Subject: Vs: thread-naming: Initial thread subject
> @@ -163,7 +163,7 @@ This is just a test message (#$((first + 6)))
> part}
> body}
> message}
> -message{ id:msg-$(printf "%03d" $((first + 7)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 7)))
> +message{ id:msg-$(printf "%03d" $((first + 7)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 7)))
> header{
> Notmuch Test Suite <test_suite at notmuchmail.org> (2001-01-12) (inbox unread)
> Subject: Sv: thread-naming: Initial thread subject
More information about the notmuch
mailing list