X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Ffrom-guessing;h=6dfaa40a9478ccdc6bf415ff0fb4fe66d89c88d7;hp=613917c945a58f48f7b7681447ee2652fc654253;hb=84719b08f757a6079f4c3331d0c476d19b265948;hpb=4813ee41d63e8bb6f699303be3123be12dfde3f5 diff --git a/test/from-guessing b/test/from-guessing index 613917c9..6dfaa40a 100755 --- a/test/from-guessing +++ b/test/from-guessing @@ -1,19 +1,18 @@ -#!/bin/bash +#!/usr/bin/env 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"' + [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}) +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}> @@ -22,17 +21,16 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender wrote: 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"' + [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}) +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}> @@ -41,17 +39,16 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender wrote: 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"' + [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}) +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}> @@ -60,19 +57,18 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender wrote: 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}) + [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}> @@ -81,41 +77,61 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender wrote: 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}) + [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 "Magic from guessing (multiple Received: headers)" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + "[header]=\"Received: from extraneous.example.com (extraneous.example.com [1.1.1.1]) +Received: from mail.example.com (mail.example.com [1.1.1.1]) + by mail.otherdomain.org (some MTA) with ESMTP id 12345678 + for ; Sat, 10 Apr 2010 07:54:51 -0400 (EDT) +Received: from extraneous.example.com (extraneous.example.com [1.1.1.1])\"" \ + '[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 +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_expect_equal '' '' 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"' + [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}) +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}> @@ -124,17 +140,16 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender wrote: 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"' + [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}) +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}> @@ -143,17 +158,16 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender wrote: 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"' + [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}) +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}> @@ -162,19 +176,18 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender wrote: 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}) + [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}> @@ -183,19 +196,18 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender wrote: 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}) + [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}>