From 14c60cf168ac3b0f277188c16e6012b7ebdadde7 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sat, 25 Feb 2017 15:31:31 +0200 Subject: [PATCH] cli/show: list all filenames of a message in the formatted output Instead of just having the first filename for the message, list all duplicate filenames of the message as a list in the formatted outputs. This bumps the format version to 3. --- devel/schemata | 5 ++++- notmuch-client.h | 2 +- notmuch-show.c | 15 ++++++++++++++- test/T070-insert.sh | 2 +- test/T160-json.sh | 10 +++++----- test/T170-sexp.sh | 10 +++++----- test/T190-multipart.sh | 6 +++--- test/T220-reply.sh | 2 +- test/T340-maildir-sync.sh | 2 +- test/T350-crypto.sh | 14 +++++++------- test/T355-smime.sh | 2 +- test/T470-missing-headers.sh | 4 ++-- test/T510-thread-replies.sh | 22 +++++++++++----------- test/test-lib.sh | 2 +- 14 files changed, 57 insertions(+), 41 deletions(-) diff --git a/devel/schemata b/devel/schemata index 41dc4a60..6dede7a4 100644 --- a/devel/schemata +++ b/devel/schemata @@ -26,6 +26,9 @@ v1 v2 - Added the thread_summary.query field. +v3 +- Replaced message.filename string with a list of filenames. + Common non-terminals -------------------- @@ -59,7 +62,7 @@ message = { # (format_message_sprinter) id: messageid, match: bool, - filename: string, + filename: [string*], timestamp: unix_time, # date header as unix time date_relative: string, # user-friendly timestamp tags: [string*], diff --git a/notmuch-client.h b/notmuch-client.h index d026e600..21b08798 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -145,7 +145,7 @@ chomp_newline (char *str) * this. New (required) map fields can be added without increasing * this. */ -#define NOTMUCH_FORMAT_CUR 2 +#define NOTMUCH_FORMAT_CUR 3 /* The minimum supported structured output format version. Requests * for format versions below this will return an error. */ #define NOTMUCH_FORMAT_MIN 1 diff --git a/notmuch-show.c b/notmuch-show.c index 22fa655a..ab4ea1c2 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -133,7 +133,20 @@ format_message_sprinter (sprinter_t *sp, notmuch_message_t *message) sp->boolean (sp, notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED)); sp->map_key (sp, "filename"); - sp->string (sp, notmuch_message_get_filename (message)); + if (notmuch_format_version >= 3) { + notmuch_filenames_t *filenames; + + sp->begin_list (sp); + for (filenames = notmuch_message_get_filenames (message); + notmuch_filenames_valid (filenames); + notmuch_filenames_move_to_next (filenames)) { + sp->string (sp, notmuch_filenames_get (filenames)); + } + notmuch_filenames_destroy (filenames); + sp->end (sp); + } else { + sp->string (sp, notmuch_message_get_filename (message)); + } sp->map_key (sp, "timestamp"); date = notmuch_message_get_date (message); diff --git a/test/T070-insert.sh b/test/T070-insert.sh index 3dd76737..9120deba 100755 --- a/test/T070-insert.sh +++ b/test/T070-insert.sh @@ -43,7 +43,7 @@ expected='[[[{ "id": "'"${gen_msg_id}"'", "match": true, "excluded": false, - "filename": "'"${cur_msg_filename}"'", + "filename": ["'"${cur_msg_filename}"'"], "timestamp": 946728000, "date_relative": "2000-01-01", "tags": ["inbox","unread"], diff --git a/test/T160-json.sh b/test/T160-json.sh index b346f37e..099632b4 100755 --- a/test/T160-json.sh +++ b/test/T160-json.sh @@ -5,16 +5,16 @@ 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\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"json-show-message\"" output=$(notmuch show --format=json "json-show-message") -test_expect_equal_json "$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 \", \"To\": \"Notmuch Test Suite \", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]" +test_expect_equal_json "$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 \", \"To\": \"Notmuch Test Suite \", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]" # This should be the same output as above. test_begin_subtest "Show message: json --body=true" output=$(notmuch show --format=json --body=true "json-show-message") -test_expect_equal_json "$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 \", \"To\": \"Notmuch Test Suite \", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]" +test_expect_equal_json "$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 \", \"To\": \"Notmuch Test Suite \", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]" test_begin_subtest "Show message: json --body=false" output=$(notmuch show --format=json --body=false "json-show-message") -test_expect_equal_json "$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 \", \"To\": \"Notmuch Test Suite \", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]" +test_expect_equal_json "$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 \", \"To\": \"Notmuch Test Suite \", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]" 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\"" @@ -33,7 +33,7 @@ test_expect_equal_json "$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_json "$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 \", \"To\": \"Notmuch Test Suite \", \"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_json "$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 \", \"To\": \"Notmuch Test Suite \", \"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' @@ -48,7 +48,7 @@ output=$(notmuch show --format=json "id:$id") filename=$(notmuch search --output=files "id:$id") # Get length of README after base64-encoding, minus additional newline. attachment_length=$(( $(base64 $TEST_DIRECTORY/README | wc -c) - 1 )) -test_expect_equal_json "$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 \", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 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\", \"content-length\": $attachment_length, \"content-transfer-encoding\": \"base64\", \"filename\": \"README\"}]}]}, []]]]" +test_expect_equal_json "$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 \", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 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\", \"content-length\": $attachment_length, \"content-transfer-encoding\": \"base64\", \"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/T170-sexp.sh b/test/T170-sexp.sh index 800ebc63..07113c0a 100755 --- a/test/T170-sexp.sh +++ b/test/T170-sexp.sh @@ -5,16 +5,16 @@ test_description="--format=sexp output" test_begin_subtest "Show message: sexp" add_message "[subject]=\"sexp-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"sexp-show-message\"" output=$(notmuch show --format=sexp "sexp-show-message") -test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite \" :To \"Notmuch Test Suite \" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))" +test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite \" :To \"Notmuch Test Suite \" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))" # This should be the same output as above. test_begin_subtest "Show message: sexp --body=true" output=$(notmuch show --format=sexp --body=true "sexp-show-message") -test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite \" :To \"Notmuch Test Suite \" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))" +test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite \" :To \"Notmuch Test Suite \" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))" test_begin_subtest "Show message: sexp --body=false" output=$(notmuch show --format=sexp --body=false "sexp-show-message") -test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite \" :To \"Notmuch Test Suite \" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\")) ())))" +test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite \" :To \"Notmuch Test Suite \" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\")) ())))" test_begin_subtest "Search message: sexp" add_message "[subject]=\"sexp-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"sexp-search-message\"" @@ -24,7 +24,7 @@ test_expect_equal "$output" "((:thread \"0000000000000002\" :timestamp 946728000 test_begin_subtest "Show message: sexp, utf-8" add_message "[subject]=\"sexp-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=sexp "jsön-show-méssage") -test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-utf8-body-sübjéct\" :From \"Notmuch Test Suite \" :To \"Notmuch Test Suite \" :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 t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-utf8-body-sübjéct\" :From \"Notmuch Test Suite \" :To \"Notmuch Test Suite \" :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: sexp, inline attachment filename" subject='sexp-show-inline-attachment-filename' @@ -39,7 +39,7 @@ output=$(notmuch show --format=sexp "id:$id") filename=$(notmuch search --output=files "id:$id") # Get length of README after base64-encoding, minus additional newline. attachment_length=$(( $(base64 $TEST_DIRECTORY/README | wc -c) - 1 )) -test_expect_equal "$output" "((((:id \"$id\" :match t :excluded nil :filename \"$filename\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\") :headers (:Subject \"sexp-show-inline-attachment-filename\" :From \"Notmuch Test Suite \" :To \"test_suite@notmuchmail.org\" :Date \"Sat, 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\" :content-transfer-encoding \"base64\" :content-length $attachment_length))))) ())))" +test_expect_equal "$output" "((((:id \"$id\" :match t :excluded nil :filename (\"$filename\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\") :headers (:Subject \"sexp-show-inline-attachment-filename\" :From \"Notmuch Test Suite \" :To \"test_suite@notmuchmail.org\" :Date \"Sat, 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\" :content-transfer-encoding \"base64\" :content-length $attachment_length))))) ())))" test_begin_subtest "Search message: sexp, utf-8" add_message "[subject]=\"sexp-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/T190-multipart.sh b/test/T190-multipart.sh index 35678909..18eb7b83 100755 --- a/test/T190-multipart.sh +++ b/test/T190-multipart.sh @@ -345,7 +345,7 @@ test_expect_success \ test_begin_subtest "--format=json --part=0, full message" notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT cat <EXPECTED -{"id": "87liy5ap00.fsf@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 ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [ +{"id": "87liy5ap00.fsf@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 ", "To": "cworth@cworth.org", "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": {"Subject": "html message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ @@ -627,7 +627,7 @@ notmuch_json_show_sanitize <EXPECTED "original": {"id": "XXXXX", "match": false, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], @@ -715,7 +715,7 @@ cat_expected_head () cat <", "Subject": "html message", "To": "B "}, diff --git a/test/T220-reply.sh b/test/T220-reply.sh index 818a8654..17741e0d 100755 --- a/test/T220-reply.sh +++ b/test/T220-reply.sh @@ -229,7 +229,7 @@ test_expect_equal_json "$output" ' ], "date_relative": "2010-01-05", "excluded": false, - "filename": "'${MAIL_DIR}'/msg-012", + "filename": ["'${MAIL_DIR}'/msg-012"], "headers": { "Date": "Tue, 05 Jan 2010 15:43:56 +0000", "From": "\u2603 ", diff --git a/test/T340-maildir-sync.sh b/test/T340-maildir-sync.sh index efeaa3f6..b474bf46 100755 --- a/test/T340-maildir-sync.sh +++ b/test/T340-maildir-sync.sh @@ -39,7 +39,7 @@ output=$(notmuch show --format=json id:${gen_msg_id} | notmuch_json_show_sanitiz test_expect_equal_json "$output" '[[[{"id": "XXXXX", "match": true, "excluded": false, -"filename": "YYYYY", +"filename": ["YYYYY"], "timestamp": 42, "date_relative": "2001-01-05", "tags": ["inbox","replied"], diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh index a1e5e206..14b215a3 100755 --- a/test/T350-crypto.sh +++ b/test/T350-crypto.sh @@ -41,7 +41,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \ expected='[[[{"id": "XXXXX", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 946728000, "date_relative": "2000-01-01", "tags": ["inbox","signed"], @@ -75,7 +75,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \ expected='[[[{"id": "XXXXX", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 946728000, "date_relative": "2000-01-01", "tags": ["inbox","signed"], @@ -109,7 +109,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \ expected='[[[{"id": "XXXXX", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 946728000, "date_relative": "2000-01-01", "tags": ["inbox","signed"], @@ -183,7 +183,7 @@ output=$(notmuch show --format=json --decrypt subject:"test encrypted message 00 expected='[[[{"id": "XXXXX", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 946728000, "date_relative": "2000-01-01", "tags": ["encrypted","inbox"], @@ -240,7 +240,7 @@ output=$(notmuch show --format=json --decrypt subject:"test encrypted message 00 expected='[[[{"id": "XXXXX", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 946728000, "date_relative": "2000-01-01", "tags": ["encrypted","inbox"], @@ -276,7 +276,7 @@ output=$(notmuch show --format=json --decrypt subject:"test encrypted message 00 expected='[[[{"id": "XXXXX", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 946728000, "date_relative": "2000-01-01", "tags": ["encrypted","inbox"], @@ -350,7 +350,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \ expected='[[[{"id": "XXXXX", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 946728000, "date_relative": "2000-01-01", "tags": ["inbox","signed"], diff --git a/test/T355-smime.sh b/test/T355-smime.sh index a8be45e7..a6db4a18 100755 --- a/test/T355-smime.sh +++ b/test/T355-smime.sh @@ -51,7 +51,7 @@ output=$(notmuch show --format=json --verify subject:"test signed message 001" \ expected='[[[{"id": "XXXXX", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 946728000, "date_relative": "2000-01-01", "tags": ["inbox","signed"], diff --git a/test/T470-missing-headers.sh b/test/T470-missing-headers.sh index 256a885f..32031e31 100755 --- a/test/T470-missing-headers.sh +++ b/test/T470-missing-headers.sh @@ -109,7 +109,7 @@ expected=$(notmuch_json_show_sanitize <", diff --git a/test/T510-thread-replies.sh b/test/T510-thread-replies.sh index 5ab066ac..fa288bb1 100755 --- a/test/T510-thread-replies.sh +++ b/test/T510-thread-replies.sh @@ -21,7 +21,7 @@ output=$(notmuch show --format=json 'subject:one' | notmuch_json_show_sanitize) expected='[[[{"id": "foo@one.com", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], @@ -34,7 +34,7 @@ expected='[[[{"id": "foo@one.com", "content": "This is just a test message (#1)\n"}]}, [[{"id": "msg-002@notmuch-test-suite", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subject": "Re: one", "From": "Notmuch Test Suite ", @@ -54,7 +54,7 @@ add_message '[in-reply-to]=""' \ output=$(notmuch show --format=json 'subject:two' | notmuch_json_show_sanitize) expected='[[[{"id": "foo@two.com", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subject": "two", "From": "Notmuch Test Suite ", @@ -63,7 +63,7 @@ expected='[[[{"id": "foo@two.com", "body": [{"id": 1, "content-type": "text/plain", "content": "This is just a test message (#3)\n"}]}, [[{"id": "msg-004@notmuch-test-suite", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subject": "Re: two", "From": "Notmuch Test Suite ", @@ -82,7 +82,7 @@ add_message '[in-reply-to]=""' \ '[subject]="Re: three"' output=$(notmuch show --format=json 'subject:three' | notmuch_json_show_sanitize) expected='[[[{"id": "foo@three.com", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subject": "three", "From": "Notmuch Test Suite ", @@ -90,7 +90,7 @@ expected='[[[{"id": "foo@three.com", "match": true, "excluded": false, "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, "content-type": "text/plain", "content": "This is just a test message (#5)\n"}]}, [[{"id": "msg-006@notmuch-test-suite", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subject": "Re: three", "From": "Notmuch Test Suite ", @@ -111,7 +111,7 @@ add_message '[in-reply-to]=""' \ '[subject]="neither"' output=$(notmuch show --format=json 'subject:four' | notmuch_json_show_sanitize) expected='[[[{"id": "foo@four.com", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subject": "four", "From": "Notmuch Test Suite ", @@ -119,7 +119,7 @@ expected='[[[{"id": "foo@four.com", "match": true, "excluded": false, "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, "content-type": "text/plain", "content": "This is just a test message (#7)\n"}]}, [[{"id": "msg-009@notmuch-test-suite", "match": false, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subject": "neither", "From": "Notmuch Test Suite ", @@ -127,7 +127,7 @@ expected='[[[{"id": "foo@four.com", "match": true, "excluded": false, "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, "content-type": "text/plain", "content": "This is just a test message (#9)\n"}]}, []]]]], [[{"id": "bar@four.com", "match": true, "excluded": false, - "filename": "YYYYY", + "filename": ["YYYYY"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subject": "not-four", "From": "Notmuch Test Suite ", @@ -145,7 +145,7 @@ add_message '[id]="bar@five.com"' \ '[subject]="not-five"' output=$(notmuch show --format=json 'subject:five' | notmuch_json_show_sanitize) expected='[[[{"id": "XXXXX", "match": true, "excluded": false, - "filename": "YYYYY", "timestamp": 42, "date_relative": "2001-01-05", + "filename": ["YYYYY"], "timestamp": 42, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subject": "five", "From": "Notmuch Test Suite ", "To": "Notmuch Test Suite ", @@ -153,7 +153,7 @@ expected='[[[{"id": "XXXXX", "match": true, "excluded": false, "content-type": "text/plain", "content": "This is just a test message (#10)\n"}]}, [[{"id": "XXXXX", "match": true, "excluded": false, - "filename": "YYYYY", "timestamp": 42, "date_relative": "2001-01-05", + "filename": ["YYYYY"], "timestamp": 42, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], "headers": {"Subject": "not-five", "From": "Notmuch Test Suite ", diff --git a/test/test-lib.sh b/test/test-lib.sh index bb32e97b..d8e15943 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -745,7 +745,7 @@ notmuch_json_show_sanitize () -e 's|"id": "[^"]*",|"id": "XXXXX",|g' \ -e 's|"Date": "Fri, 05 Jan 2001 [^"]*0000"|"Date": "GENERATED_DATE"|g' \ -e 's|"filename": "signature.asc",||g' \ - -e 's|"filename": "/[^"]*",|"filename": "YYYYY",|g' \ + -e 's|"filename": \["/[^"]*"\],|"filename": \["YYYYY"\],|g' \ -e 's|"timestamp": 97.......|"timestamp": 42|g' \ -e 's|"content-length": [1-9][0-9]*|"content-length": "NONZERO"|g' } -- 2.43.0