From 4813ee41d63e8bb6f699303be3123be12dfde3f5 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 20 Sep 2010 14:36:31 -0700 Subject: test: Print section names, and rename all test sections Now that we can usefully pass section names via the NOTMUCH_SKIP_TESTS environment variable, it's useful to actually print those names out for the user. Then, since we're now printing these names, let's use nicer names, (not excessively long but also not using abbreviations like "msg"). --- test/from-guessing | 205 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+) create mode 100755 test/from-guessing (limited to 'test/from-guessing') diff --git a/test/from-guessing b/test/from-guessing new file mode 100755 index 00000000..613917c9 --- /dev/null +++ b/test/from-guessing @@ -0,0 +1,205 @@ +#!/bin/bash +test_description="From line heuristics (with multiple configured addresses)" +. ./test-lib.sh + +test_begin_subtest "Magic from guessing (nothing to go on)" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +test_expect_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 -0000, Sender wrote: +> from guessing test" + +test_begin_subtest "Magic from guessing (Envelope-to:)" +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 -0000"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +test_expect_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 -0000, Sender wrote: +> from guessing test" + +test_begin_subtest "Magic from guessing (X-Original-To:)" +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 -0000"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +test_expect_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 -0000, Sender wrote: +> from guessing test" + +test_begin_subtest "Magic from guessing (Received: .. for ..)" +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 -0000"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +test_expect_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 -0000, Sender wrote: +> from guessing test" + +test_begin_subtest "Magic from guessing (Received: domain)" +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 -0000"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +test_expect_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 -0000, Sender wrote: +> from guessing test" + + +test_begin_subtest "Testing From line heuristics (with single configured address)" +sed -i -e "s/^other_email.*//" "${NOTMUCH_CONFIG}" + +test_begin_subtest "Magic from guessing (nothing to go on)" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +test_expect_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 -0000, Sender wrote: +> from guessing test" + +test_begin_subtest "Magic from guessing (Envelope-to:)" +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 -0000"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +test_expect_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 -0000, Sender wrote: +> from guessing test" + +test_begin_subtest "Magic from guessing (X-Original-To:)" +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 -0000"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +test_expect_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 -0000, Sender wrote: +> from guessing test" + +test_begin_subtest "Magic from guessing (Received: .. for ..)" +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 -0000"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +test_expect_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 -0000, Sender wrote: +> from guessing test" + +test_begin_subtest "Magic from guessing (Received: domain)" +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 -0000"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +test_expect_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 -0000, Sender wrote: +> from guessing test" + +test_done -- cgit v1.2.3