From a755c9d6a9099366cc82ba3a4bee8e6d2b83d529 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Thu, 9 Jan 2014 17:18:59 +0200 Subject: test: renamed test scripts to format T\d\d\d-name.sh All test scripts to be executed are now named as T\d\d\d-name.sh, numers in increments of 10. This eases adding new tests and developers to see which are test scripts that are executed by test suite and in which order. --- test/T470-missing-headers.sh | 164 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100755 test/T470-missing-headers.sh (limited to 'test/T470-missing-headers.sh') diff --git a/test/T470-missing-headers.sh b/test/T470-missing-headers.sh new file mode 100755 index 00000000..cb38301c --- /dev/null +++ b/test/T470-missing-headers.sh @@ -0,0 +1,164 @@ +#!/usr/bin/env bash +test_description='messages with missing headers' +. ./test-lib.sh + +# Notmuch requires at least one of from, subject, or to or it will +# ignore the file. Generate two messages so that together they cover +# all possible missing headers. We also give one of the messages a +# date to ensure stable result ordering. + +cat < "${MAIL_DIR}/msg-2" +To: Notmuch Test Suite +Date: Fri, 05 Jan 2001 15:43:57 +0000 + +Body +EOF + +cat < "${MAIL_DIR}/msg-1" +From: Notmuch Test Suite + +Body +EOF + +NOTMUCH_NEW + +test_begin_subtest "Search: text" +output=$(notmuch search '*' | notmuch_search_sanitize) +test_expect_equal "$output" "\ +thread:XXX 2001-01-05 [1/1] (null); (inbox unread) +thread:XXX 1970-01-01 [1/1] Notmuch Test Suite; (inbox unread)" + +test_begin_subtest "Search: json" +output=$(notmuch search --format=json '*' | notmuch_search_sanitize) +test_expect_equal_json "$output" ' +[ + { + "authors": "", + "date_relative": "2001-01-05", + "matched": 1, + "subject": "", + "tags": [ + "inbox", + "unread" + ], + "thread": "XXX", + "timestamp": 978709437, + "total": 1, + "query": ["id:notmuch-sha1-7a6e4eac383ef958fcd3ebf2143db71b8ff01161", null] + }, + { + "authors": "Notmuch Test Suite", + "date_relative": "1970-01-01", + "matched": 1, + "subject": "", + "tags": [ + "inbox", + "unread" + ], + "thread": "XXX", + "timestamp": 0, + "total": 1, + "query": ["id:notmuch-sha1-ca55943aff7a72baf2ab21fa74fab3d632401334", null] + } +]' + +test_begin_subtest "Show: text" +output=$(notmuch show '*' | notmuch_show_sanitize) +test_expect_equal "$output" "\ + message{ id:notmuch-sha1-7a6e4eac383ef958fcd3ebf2143db71b8ff01161 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-2 + header{ + (2001-01-05) (inbox unread) +Subject: (null) +From: (null) +To: Notmuch Test Suite +Date: Fri, 05 Jan 2001 15:43:57 +0000 + header} + body{ + part{ ID: 1, Content-type: text/plain +Body + part} + body} + message} + message{ id:notmuch-sha1-ca55943aff7a72baf2ab21fa74fab3d632401334 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-1 + header{ +Notmuch Test Suite (1970-01-01) (inbox unread) +Subject: (null) +From: Notmuch Test Suite +Date: Thu, 01 Jan 1970 00:00:00 +0000 + header} + body{ + part{ ID: 1, Content-type: text/plain +Body + part} + body} + message}" + +test_begin_subtest "Show: json" +output=$(notmuch show --format=json '*' | notmuch_json_show_sanitize) +expected=$(notmuch_json_show_sanitize <" + }, + "id": "XXXXX", + "match": true, + "tags": [ + "inbox", + "unread" + ], + "timestamp": 978709437 + }, + [] + ] + ], + [ + [ + { + "body": [ + { + "content": "Body\n", + "content-type": "text/plain", + "id": 1 + } + ], + "date_relative": "1970-01-01", + "excluded": false, + "filename": "YYYYY", + "headers": { + "Date": "Thu, 01 Jan 1970 00:00:00 +0000", + "From": "Notmuch Test Suite ", + "Subject": "" + }, + "id": "XXXXX", + "match": true, + "tags": [ + "inbox", + "unread" + ], + "timestamp": 0 + }, + [] + ] + ] +] +EOF +) +test_expect_equal_json "$output" "$expected" + +test_done -- cgit v1.2.3