X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2Fnotmuch-test;h=00ac6b0e3a2e11ba0adb6c3966b570210d999f9a;hb=06bf04500ba282052d38adf428219968ae62bb54;hp=e1ff55d16bd0dfd4fc7ed41b8eeaa0bcbfe5884f;hpb=a35a9a77af1b5e5afa6d78fcc461a60acafb31b6;p=notmuch diff --git a/test/notmuch-test b/test/notmuch-test index e1ff55d1..00ac6b0e 100755 --- a/test/notmuch-test +++ b/test/notmuch-test @@ -66,13 +66,15 @@ increment_mtime () # '[cc]="Some User "' # [reply-to]=some-address # [in-reply-to]= +# [references]= +# [content-type]=content-type-specification # '[header]=full header line, including keyword' # # Additional values for email headers. If these are not provided # then the relevant headers will simply not appear in the # message. # -# '[id]=' +# '[id]=message-id' # # Controls the message-id of the created message. gen_msg_cnt=0 @@ -84,12 +86,12 @@ generate_message () local -A template="($@)" local additional_headers + gen_msg_cnt=$((gen_msg_cnt + 1)) + gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt) + if [ -z "${template[id]}" ]; then - gen_msg_cnt=$((gen_msg_cnt + 1)) - gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt) gen_msg_id="${gen_msg_name}@notmuch-test-suite" else - gen_msg_name="msg-${template[id]}" gen_msg_id="${template[id]}" fi @@ -141,6 +143,16 @@ ${additional_headers}" ${additional_headers}" fi + if [ ! -z "${template[references]}" ]; then + additional_headers="References: ${template[references]} +${additional_headers}" + fi + + if [ ! -z "${template[content-type]}" ]; then + additional_headers="Content-Type: ${template[content-type]} +${additional_headers}" + fi + cat <$gen_msg_filename From: ${template[from]} @@ -798,6 +810,22 @@ References: <${gen_msg_id}> On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: > Un-munging Reply-To" +printf " Message with header of exactly 200 bytes...\t" + +add_message '[subject]="This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces"' \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \ + '[body]="200-byte header"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +pass_if_equal "$output" "From: Notmuch Test Suite +Subject: Re: This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces +Bcc: test_suite@notmuchmail.org +In-Reply-To: <${gen_msg_id}> +References: <${gen_msg_id}> + +On Tue, 05 Jan 2010 15:43:56 -0800, Notmuch Test Suite wrote: +> 200-byte header" + printf "\nTesting handling of uuencoded data:\n" add_message [subject]=uuencodetest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \ @@ -897,7 +925,7 @@ printf " Searching when only first message matches...\t" output=$($NOTMUCH search User | notmuch_search_sanitize) pass_if_equal "$output" "thread:XXX 2000-01-01 [1/3] User| User1, User2; author-reorder-threadtest (inbox unread)" -printf "\nTesting From line heuristics;\n" +printf "\nTesting From line heuristics (with multiple configured addresses):\n" printf " Magic from guessing (nothing to go on)...\t" add_message '[from]="Sender "' \ [to]=mailinglist@notmuchmail.org \ @@ -996,6 +1024,156 @@ References: <${gen_msg_id}> On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: > from guessing test" + +printf "\nTesting From line heuristics (with single configured address):\n" +sed -i -e 's/^other_email.*//' ${NOTMUCH_CONFIG} + +printf " Magic from guessing (nothing to go on)...\t" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +pass_if_equal "$output" "From: Notmuch Test Suite +Subject: Re: notmuch-reply-test +To: Sender , mailinglist@notmuchmail.org +Bcc: test_suite@notmuchmail.org +In-Reply-To: <${gen_msg_id}> +References: <${gen_msg_id}> + +On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: +> from guessing test" + +printf " Magic from guessing (Envelope-to:)...\t\t" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[header]="Envelope-To: test_suite_other@notmuchmail.org"' \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +pass_if_equal "$output" "From: Notmuch Test Suite +Subject: Re: notmuch-reply-test +To: Sender , mailinglist@notmuchmail.org +Bcc: test_suite@notmuchmail.org +In-Reply-To: <${gen_msg_id}> +References: <${gen_msg_id}> + +On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: +> from guessing test" + +printf " Magic from guessing (X-Original-To:)...\t" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[header]="X-Original-To: test_suite_other@notmuchmail.org"' \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +pass_if_equal "$output" "From: Notmuch Test Suite +Subject: Re: notmuch-reply-test +To: Sender , mailinglist@notmuchmail.org +Bcc: test_suite@notmuchmail.org +In-Reply-To: <${gen_msg_id}> +References: <${gen_msg_id}> + +On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: +> from guessing test" + +printf " Magic from guessing (Received: .. for ..)...\t" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[header]="Received: from mail.example.com (mail.example.com [1.1.1.1])\ + by mail.notmuchmail.org (some MTA) with ESMTP id 12345678\ + for ; Sat, 10 Apr 2010 07:54:51 -0400 (EDT)"' \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +pass_if_equal "$output" "From: Notmuch Test Suite +Subject: Re: notmuch-reply-test +To: Sender , mailinglist@notmuchmail.org +Bcc: test_suite@notmuchmail.org +In-Reply-To: <${gen_msg_id}> +References: <${gen_msg_id}> + +On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: +> from guessing test" + +printf " Magic from guessing (Received: domain)...\t" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[header]="Received: from mail.example.com (mail.example.com [1.1.1.1])\ + by mail.otherdomain.org (some MTA) with ESMTP id 12345678\ + Sat, 10 Apr 2010 07:54:51 -0400 (EDT)"' \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +pass_if_equal "$output" "From: Notmuch Test Suite +Subject: Re: notmuch-reply-test +To: Sender , mailinglist@notmuchmail.org +Bcc: test_suite@notmuchmail.org +In-Reply-To: <${gen_msg_id}> +References: <${gen_msg_id}> + +On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: +> from guessing test" + +printf "\nTesting messages with ridiculously-long message IDs...\n" +printf " Referencing long ID before adding...\t\t" +generate_message '[subject]="Reference of ridiculously-long message ID"' \ + '[references]=\' + +output=$(NOTMUCH_NEW) +pass_if_equal "$output" "Added 1 new message to the database." + +printf " Adding message with long ID...\t\t\t" +generate_message '[subject]="A ridiculously-long message ID"' \ + '[id]=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-' + +output=$(NOTMUCH_NEW) +pass_if_equal "$output" "Added 1 new message to the database." + +printf " Referencing long ID after adding...\t\t" +generate_message '[subject]="Reply to ridiculously-long message ID"' \ + '[in-reply-to]=\' + +output=$(NOTMUCH_NEW) +pass_if_equal "$output" "Added 1 new message to the database." + +printf " Ensure all messages were threaded together...\t" + +output=$($NOTMUCH search 'subject:"a ridiculously-long message ID"' | notmuch_search_sanitize) +pass_if_equal "$output" "thread:XXX 2001-01-05 [1/3] Notmuch Test Suite; A ridiculously-long message ID (inbox unread)" + +printf "\nTesting encoding issues...\n" +printf " Message with text of unknown charset...\t" +add_message '[content-type]="text/plain; charset=unknown-8bit"' \ + '[body]=irrelevant' + +output=$($NOTMUCH show id:${gen_msg_id} 2>&1 | notmuch_show_sanitize) +pass_if_equal "$output" " message{ id:msg-074@notmuch-test-suite depth:0 match:1 filename:/XXX/mail/msg-074 + header{ +Notmuch Test Suite (2001-01-05) (inbox unread) +Subject: Test message #74 +From: Notmuch Test Suite +To: Notmuch Test Suite +Date: Tue, 05 Jan 2001 15:43:57 -0800 + header} + body{ + part{ ID: 1, Content-type: text/plain +irrelevant + part} + body} + message}" + echo "" echo "Notmuch test suite complete."