mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 09:24:54 +01:00
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.
This commit is contained in:
parent
524372de10
commit
14c60cf168
14 changed files with 57 additions and 41 deletions
|
@ -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*],
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"],
|
||||
|
|
|
@ -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 <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"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 <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"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 <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"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 <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"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 <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"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 <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"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 <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"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 <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"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 <test_suite@notmuchmail.org>\", \"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 <test_suite@notmuchmail.org>\", \"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\""
|
||||
|
|
|
@ -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 <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :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 <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :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 <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :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 <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :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 <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :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 <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :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 <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :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 <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :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 <test_suite@notmuchmail.org>\" :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 <test_suite@notmuchmail.org>\" :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\""
|
||||
|
|
|
@ -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 <<EOF >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 <cworth@cworth.org>", "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 <cworth@cworth.org>", "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 <cworth@cworth.org>", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [
|
||||
|
@ -627,7 +627,7 @@ notmuch_json_show_sanitize <<EOF >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 <<EOF
|
||||
[[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",
|
||||
"timestamp": 946684800,
|
||||
"filename": "${MAIL_DIR}/include-html",
|
||||
"filename": ["${MAIL_DIR}/include-html"],
|
||||
"tags": ["inbox", "unread"],
|
||||
"headers": { "Date": "Sat, 01 Jan 2000 00:00:00 +0000", "From": "A <a@example.com>",
|
||||
"Subject": "html message", "To": "B <b@example.com>"},
|
||||
|
|
|
@ -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 <snowman@example.com>",
|
||||
|
|
|
@ -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"],
|
||||
|
|
|
@ -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"],
|
||||
|
|
|
@ -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"],
|
||||
|
|
|
@ -109,7 +109,7 @@ expected=$(notmuch_json_show_sanitize <<EOF
|
|||
],
|
||||
"date_relative": "2001-01-05",
|
||||
"excluded": false,
|
||||
"filename": "YYYYY",
|
||||
"filename": ["YYYYY"],
|
||||
"headers": {
|
||||
"Date": "Fri, 05 Jan 2001 15:43:57 +0000",
|
||||
"From": "",
|
||||
|
@ -139,7 +139,7 @@ expected=$(notmuch_json_show_sanitize <<EOF
|
|||
],
|
||||
"date_relative": "1970-01-01",
|
||||
"excluded": false,
|
||||
"filename": "YYYYY",
|
||||
"filename": ["YYYYY"],
|
||||
"headers": {
|
||||
"Date": "Thu, 01 Jan 1970 00:00:00 +0000",
|
||||
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
|
||||
|
|
|
@ -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 <test_suite@notmuchmail.org>",
|
||||
|
@ -54,7 +54,7 @@ add_message '[in-reply-to]="<bar@baz.com>"' \
|
|||
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 <test_suite@notmuchmail.org>",
|
||||
|
@ -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 <test_suite@notmuchmail.org>",
|
||||
|
@ -82,7 +82,7 @@ add_message '[in-reply-to]="<foo@three.com>"' \
|
|||
'[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 <test_suite@notmuchmail.org>",
|
||||
|
@ -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 <test_suite@notmuchmail.org>",
|
||||
|
@ -111,7 +111,7 @@ add_message '[in-reply-to]="<baz@four.com>"' \
|
|||
'[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 <test_suite@notmuchmail.org>",
|
||||
|
@ -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 <test_suite@notmuchmail.org>",
|
||||
|
@ -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 <test_suite@notmuchmail.org>",
|
||||
|
@ -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 <test_suite@notmuchmail.org>",
|
||||
"To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
|
||||
|
@ -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 <test_suite@notmuchmail.org>",
|
||||
|
|
|
@ -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'
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue