From 7263aa9ec3f72bb65a491b2c64345ab5258b24ee Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 17 Sep 2010 15:58:39 -0700 Subject: test: Rename all tests to get rid of the ugly numbers in file names. The numbers were meaningless, and they made it hard to find a file of interest. Instead, we get the ordering we want by adding an explicit list of tests to run to the notmuch-test script. --- test/thread-naming | 182 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100755 test/thread-naming (limited to 'test/thread-naming') diff --git a/test/thread-naming b/test/thread-naming new file mode 100755 index 00000000..31c01532 --- /dev/null +++ b/test/thread-naming @@ -0,0 +1,182 @@ +#!/bin/bash +test_description="naming of threads with changing subject" +. ./test-lib.sh + +test_begin_subtest 'Generate some messages' +add_message '[subject]="thread-naming: Initial thread subject"' \ + '[date]="Fri, 05 Jan 2001 15:43:56 -0000"' +first=${gen_msg_cnt} +parent=${gen_msg_id} +add_message '[subject]="thread-naming: Older changed subject"' \ + '[date]="Sat, 06 Jan 2001 15:43:56 -0000"' \ + "[in-reply-to]=\<$parent\>" +add_message '[subject]="thread-naming: Newer changed subject"' \ + '[date]="Sun, 07 Jan 2001 15:43:56 -0000"' \ + "[in-reply-to]=\<$parent\>" +add_message '[subject]="thread-naming: Final thread subject"' \ + '[date]="Mon, 08 Jan 2001 15:43:56 -0000"' \ + "[in-reply-to]=\<$parent\>" +final=${gen_msg_id} + +test_begin_subtest "Initial thread name (oldest-first search)" +output=$($NOTMUCH search --sort=oldest-first thread-naming and tag:inbox | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-05 [4/4] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)" + +test_begin_subtest "Initial thread name (newest-first search)" +output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-08 [4/4] Notmuch Test Suite; thread-naming: Final thread subject (inbox unread)" + +# Remove oldest and newest messages from search results +$NOTMUCH tag -inbox id:$parent or id:$final + +test_begin_subtest "Changed thread name (oldest-first search)" +output=$($NOTMUCH search --sort=oldest-first thread-naming and tag:inbox | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-06 [2/4] Notmuch Test Suite; thread-naming: Older changed subject (inbox unread)" + +test_begin_subtest "Changed thread name (newest-first search)" +output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-07 [2/4] Notmuch Test Suite; thread-naming: Newer changed subject (inbox unread)" + +test_begin_subtest "Ignore added reply prefix (Re:)" +add_message '[subject]="Re: thread-naming: Initial thread subject"' \ + '[date]="Tue, 09 Jan 2001 15:43:45 -0000"' \ + "[in-reply-to]=\<$parent\>" +output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-09 [3/5] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)" + +test_begin_subtest "Ignore added reply prefix (Aw:)" +add_message '[subject]="Aw: thread-naming: Initial thread subject"' \ + '[date]="Wed, 10 Jan 2001 15:43:45 -0000"' \ + "[in-reply-to]=\<$parent\>" +output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-10 [4/6] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)" + +test_begin_subtest "Ignore added reply prefix (Vs:)" +add_message '[subject]="Vs: thread-naming: Initial thread subject"' \ + '[date]="Thu, 11 Jan 2001 15:43:45 -0000"' \ + "[in-reply-to]=\<$parent\>" +output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-11 [5/7] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)" + +test_begin_subtest "Ignore added reply prefix (Sv:)" +add_message '[subject]="Sv: thread-naming: Initial thread subject"' \ + '[date]="Fri, 12 Jan 2001 15:43:45 -0000"' \ + "[in-reply-to]=\<$parent\>" +output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-12 [6/8] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)" + +test_begin_subtest 'Test order of messages in "notmuch show"' +output=$($NOTMUCH show thread-naming | notmuch_show_sanitize) +test_expect_equal "$output" " message{ id:msg-$(printf "%03d" $first)@notmuch-test-suite depth:0 match:1 filename:/XXX/mail/msg-$(printf "%03d" $first) + header{ +Notmuch Test Suite (2001-01-05) (unread) +Subject: thread-naming: Initial thread subject +From: Notmuch Test Suite +To: Notmuch Test Suite +Date: Fri, 05 Jan 2001 15:43:56 -0000 + header} + body{ + part{ ID: 1, Content-type: text/plain +This is just a test message (#$first) + part} + body} + message} + message{ id:msg-$(printf "%03d" $((first + 1)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 1))) + header{ +Notmuch Test Suite (2001-01-06) (inbox unread) +Subject: thread-naming: Older changed subject +From: Notmuch Test Suite +To: Notmuch Test Suite +Date: Sat, 06 Jan 2001 15:43:56 -0000 + header} + body{ + part{ ID: 1, Content-type: text/plain +This is just a test message (#$((first + 1))) + part} + body} + message} + message{ id:msg-$(printf "%03d" $((first + 2)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 2))) + header{ +Notmuch Test Suite (2001-01-07) (inbox unread) +Subject: thread-naming: Newer changed subject +From: Notmuch Test Suite +To: Notmuch Test Suite +Date: Sun, 07 Jan 2001 15:43:56 -0000 + header} + body{ + part{ ID: 1, Content-type: text/plain +This is just a test message (#$((first + 2))) + part} + body} + message} + message{ id:msg-$(printf "%03d" $((first + 3)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 3))) + header{ +Notmuch Test Suite (2001-01-08) (unread) +Subject: thread-naming: Final thread subject +From: Notmuch Test Suite +To: Notmuch Test Suite +Date: Mon, 08 Jan 2001 15:43:56 -0000 + header} + body{ + part{ ID: 1, Content-type: text/plain +This is just a test message (#$((first + 3))) + part} + body} + message} + message{ id:msg-$(printf "%03d" $((first + 4)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 4))) + header{ +Notmuch Test Suite (2001-01-09) (inbox unread) +Subject: Re: thread-naming: Initial thread subject +From: Notmuch Test Suite +To: Notmuch Test Suite +Date: Tue, 09 Jan 2001 15:43:45 -0000 + header} + body{ + part{ ID: 1, Content-type: text/plain +This is just a test message (#$((first + 4))) + part} + body} + message} + message{ id:msg-$(printf "%03d" $((first + 5)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 5))) + header{ +Notmuch Test Suite (2001-01-10) (inbox unread) +Subject: Aw: thread-naming: Initial thread subject +From: Notmuch Test Suite +To: Notmuch Test Suite +Date: Wed, 10 Jan 2001 15:43:45 -0000 + header} + body{ + part{ ID: 1, Content-type: text/plain +This is just a test message (#$((first + 5))) + part} + body} + message} + message{ id:msg-$(printf "%03d" $((first + 6)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 6))) + header{ +Notmuch Test Suite (2001-01-11) (inbox unread) +Subject: Vs: thread-naming: Initial thread subject +From: Notmuch Test Suite +To: Notmuch Test Suite +Date: Thu, 11 Jan 2001 15:43:45 -0000 + header} + body{ + part{ ID: 1, Content-type: text/plain +This is just a test message (#$((first + 6))) + part} + body} + message} + message{ id:msg-$(printf "%03d" $((first + 7)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 7))) + header{ +Notmuch Test Suite (2001-01-12) (inbox unread) +Subject: Sv: thread-naming: Initial thread subject +From: Notmuch Test Suite +To: Notmuch Test Suite +Date: Fri, 12 Jan 2001 15:43:45 -0000 + header} + body{ + part{ ID: 1, Content-type: text/plain +This is just a test message (#$((first + 7))) + part} + body} + message}" +test_done -- cgit v1.2.3