mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
5398e6966a
The changes are: - The notmuch-test was split into several files (t000?-*.sh). - Removed helper functions which were moved to test-lib.sh - Replaced every printf with test_expect_success. - Test commands chained with && (test-lib.sh doesn't use "set -e" in order to complete the test suite even if something fails) - Many variables such as ${MAIL_DIR} were properly quoted as they contain spaces. - Changed quoting patterns in add_message and generate_message (single quotes are already used by the test framework). - ${TEST_DIR} replaced by ${PWD} QUICK HOWTO: To run the whole test suite make To run only a single test ./t0001-new.sh To stop on the first error ./t0001-new.sh -i then mail store and database can be inspected in "trash directory.t0001-new" To see the output of tests ./t0001-new.sh -v To not remove trash directory at the end: ./t0001-new.sh -d To run all tests verbosely: make GIT_TEST_OPTS="-v" Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
215 lines
8.5 KiB
Bash
Executable file
215 lines
8.5 KiB
Bash
Executable file
#!/bin/bash
|
|
test_description="From line heuristics (with multiple configured addresses)"
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success "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 -0800\"" \
|
|
"[body]=\"from guessing test\"" &&
|
|
|
|
output=$($NOTMUCH reply id:${gen_msg_id}) &&
|
|
pass_if_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 -0800, Sender <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
'
|
|
test_expect_success "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 -0800\"" \
|
|
"[body]=\"from guessing test\"" &&
|
|
|
|
output=$($NOTMUCH reply id:${gen_msg_id}) &&
|
|
pass_if_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 -0800, Sender <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
'
|
|
test_expect_success "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 -0800\"" \
|
|
"[body]=\"from guessing test\"" &&
|
|
|
|
output=$($NOTMUCH reply id:${gen_msg_id}) &&
|
|
pass_if_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 -0800, Sender <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
'
|
|
test_expect_success "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 -0800\"" \
|
|
"[body]=\"from guessing test\"" &&
|
|
|
|
output=$($NOTMUCH reply id:${gen_msg_id}) &&
|
|
pass_if_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 -0800, Sender <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
'
|
|
test_expect_success "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 -0800\"" \
|
|
"[body]=\"from guessing test\"" &&
|
|
|
|
output=$($NOTMUCH reply id:${gen_msg_id}) &&
|
|
pass_if_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 -0800, Sender <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
|
|
'
|
|
test_expect_success "Testing From line heuristics (with single configured address)" '
|
|
sed -i -e "s/^other_email.*//" "${NOTMUCH_CONFIG}"
|
|
|
|
'
|
|
test_expect_success "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 -0800\"" \
|
|
"[body]=\"from guessing test\"" &&
|
|
|
|
output=$($NOTMUCH reply id:${gen_msg_id}) &&
|
|
pass_if_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 -0800, Sender <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
'
|
|
test_expect_success "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 -0800\"" \
|
|
"[body]=\"from guessing test\"" &&
|
|
|
|
output=$($NOTMUCH reply id:${gen_msg_id}) &&
|
|
pass_if_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 -0800, Sender <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
'
|
|
test_expect_success "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 -0800\"" \
|
|
"[body]=\"from guessing test\"" &&
|
|
|
|
output=$($NOTMUCH reply id:${gen_msg_id}) &&
|
|
pass_if_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 -0800, Sender <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
'
|
|
test_expect_success "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 -0800\"" \
|
|
"[body]=\"from guessing test\"" &&
|
|
|
|
output=$($NOTMUCH reply id:${gen_msg_id}) &&
|
|
pass_if_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 -0800, Sender <sender@example.com> wrote:
|
|
> from guessing test"
|
|
|
|
'
|
|
test_expect_success "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 -0800\"" \
|
|
"[body]=\"from guessing test\"" &&
|
|
|
|
output=$($NOTMUCH reply id:${gen_msg_id}) &&
|
|
pass_if_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 -0800, Sender <sender@example.com> wrote:
|
|
> from guessing test"
|
|
'
|
|
test_done
|