mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 12:28:09 +01:00
c92ad8bf6a
The original git test suite works by concatenating many commands into a very long string (each separated by &&). This is painful to work with since it prevents the editor from helping by parsing the shell script, indenting, colorizing, etc. Instead, we switch this back to something like the original notmuch test suite, and add two new functions to test-lib.sh (test_begin_subtest and test_expect_equal) to support these. This also fixes the test suite to once again display the diff when a test fails to generate the expected input.
205 lines
8.3 KiB
Bash
Executable file
205 lines
8.3 KiB
Bash
Executable file
#!/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 <sender@example.com>"' \
|
|
[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 <test_suite@notmuchmail.org>
|
|
Subject: Re: notmuch-reply-test
|
|
To: Sender <sender@example.com>, 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 <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
test_begin_subtest "Magic from guessing (Envelope-to:)"
|
|
add_message '[from]="Sender <sender@example.com>"' \
|
|
[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 <test_suite_other@notmuchmail.org>
|
|
Subject: Re: notmuch-reply-test
|
|
To: Sender <sender@example.com>, 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 <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
test_begin_subtest "Magic from guessing (X-Original-To:)"
|
|
add_message '[from]="Sender <sender@example.com>"' \
|
|
[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 <test_suite_other@notmuchmail.org>
|
|
Subject: Re: notmuch-reply-test
|
|
To: Sender <sender@example.com>, 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 <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
test_begin_subtest "Magic from guessing (Received: .. for ..)"
|
|
add_message '[from]="Sender <sender@example.com>"' \
|
|
[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 <test_suite_other@notmuchmail.org>; 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 <test_suite_other@notmuchmail.org>
|
|
Subject: Re: notmuch-reply-test
|
|
To: Sender <sender@example.com>, 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 <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
test_begin_subtest "Magic from guessing (Received: domain)"
|
|
add_message '[from]="Sender <sender@example.com>"' \
|
|
[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 <test_suite@otherdomain.org>
|
|
Subject: Re: notmuch-reply-test
|
|
To: Sender <sender@example.com>, 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 <sender@example.com> 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 <sender@example.com>"' \
|
|
[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 <test_suite@notmuchmail.org>
|
|
Subject: Re: notmuch-reply-test
|
|
To: Sender <sender@example.com>, 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 <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
test_begin_subtest "Magic from guessing (Envelope-to:)"
|
|
add_message '[from]="Sender <sender@example.com>"' \
|
|
[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 <test_suite@notmuchmail.org>
|
|
Subject: Re: notmuch-reply-test
|
|
To: Sender <sender@example.com>, 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 <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
test_begin_subtest "Magic from guessing (X-Original-To:)"
|
|
add_message '[from]="Sender <sender@example.com>"' \
|
|
[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 <test_suite@notmuchmail.org>
|
|
Subject: Re: notmuch-reply-test
|
|
To: Sender <sender@example.com>, 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 <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
test_begin_subtest "Magic from guessing (Received: .. for ..)"
|
|
add_message '[from]="Sender <sender@example.com>"' \
|
|
[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 <test_suite_other@notmuchmail.org>; 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 <test_suite@notmuchmail.org>
|
|
Subject: Re: notmuch-reply-test
|
|
To: Sender <sender@example.com>, 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 <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
test_begin_subtest "Magic from guessing (Received: domain)"
|
|
add_message '[from]="Sender <sender@example.com>"' \
|
|
[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 <test_suite@notmuchmail.org>
|
|
Subject: Re: notmuch-reply-test
|
|
To: Sender <sender@example.com>, 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 <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
test_done
|