]> git.notmuchmail.org Git - notmuch/blob - test/thread-naming
test: Rename all tests to get rid of the ugly numbers in file names.
[notmuch] / test / thread-naming
1 #!/bin/bash
2 test_description="naming of threads with changing subject"
3 . ./test-lib.sh
4
5 test_begin_subtest 'Generate some messages'
6 add_message '[subject]="thread-naming: Initial thread subject"' \
7             '[date]="Fri, 05 Jan 2001 15:43:56 -0000"'
8 first=${gen_msg_cnt}
9 parent=${gen_msg_id}
10 add_message '[subject]="thread-naming: Older changed subject"' \
11             '[date]="Sat, 06 Jan 2001 15:43:56 -0000"' \
12             "[in-reply-to]=\<$parent\>"
13 add_message '[subject]="thread-naming: Newer changed subject"' \
14             '[date]="Sun, 07 Jan 2001 15:43:56 -0000"' \
15             "[in-reply-to]=\<$parent\>"
16 add_message '[subject]="thread-naming: Final thread subject"' \
17             '[date]="Mon, 08 Jan 2001 15:43:56 -0000"' \
18             "[in-reply-to]=\<$parent\>"
19 final=${gen_msg_id}
20
21 test_begin_subtest "Initial thread name (oldest-first search)"
22 output=$($NOTMUCH search --sort=oldest-first thread-naming and tag:inbox | notmuch_search_sanitize)
23 test_expect_equal "$output" "thread:XXX   2001-01-05 [4/4] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
24
25 test_begin_subtest "Initial thread name (newest-first search)"
26 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
27 test_expect_equal "$output" "thread:XXX   2001-01-08 [4/4] Notmuch Test Suite; thread-naming: Final thread subject (inbox unread)"
28
29 # Remove oldest and newest messages from search results
30 $NOTMUCH tag -inbox id:$parent or id:$final
31
32 test_begin_subtest "Changed thread name (oldest-first search)"
33 output=$($NOTMUCH search --sort=oldest-first thread-naming and tag:inbox | notmuch_search_sanitize)
34 test_expect_equal "$output" "thread:XXX   2001-01-06 [2/4] Notmuch Test Suite; thread-naming: Older changed subject (inbox unread)"
35
36 test_begin_subtest "Changed thread name (newest-first search)"
37 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
38 test_expect_equal "$output" "thread:XXX   2001-01-07 [2/4] Notmuch Test Suite; thread-naming: Newer changed subject (inbox unread)"
39
40 test_begin_subtest "Ignore added reply prefix (Re:)"
41 add_message '[subject]="Re: thread-naming: Initial thread subject"' \
42             '[date]="Tue, 09 Jan 2001 15:43:45 -0000"' \
43             "[in-reply-to]=\<$parent\>"
44 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
45 test_expect_equal "$output" "thread:XXX   2001-01-09 [3/5] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
46
47 test_begin_subtest "Ignore added reply prefix (Aw:)"
48 add_message '[subject]="Aw: thread-naming: Initial thread subject"' \
49             '[date]="Wed, 10 Jan 2001 15:43:45 -0000"' \
50             "[in-reply-to]=\<$parent\>"
51 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
52 test_expect_equal "$output" "thread:XXX   2001-01-10 [4/6] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
53
54 test_begin_subtest "Ignore added reply prefix (Vs:)"
55 add_message '[subject]="Vs: thread-naming: Initial thread subject"' \
56             '[date]="Thu, 11 Jan 2001 15:43:45 -0000"' \
57             "[in-reply-to]=\<$parent\>"
58 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
59 test_expect_equal "$output" "thread:XXX   2001-01-11 [5/7] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
60
61 test_begin_subtest "Ignore added reply prefix (Sv:)"
62 add_message '[subject]="Sv: thread-naming: Initial thread subject"' \
63             '[date]="Fri, 12 Jan 2001 15:43:45 -0000"' \
64             "[in-reply-to]=\<$parent\>"
65 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
66 test_expect_equal "$output" "thread:XXX   2001-01-12 [6/8] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
67
68 test_begin_subtest 'Test order of messages in "notmuch show"'
69 output=$($NOTMUCH show thread-naming | notmuch_show_sanitize)
70 test_expect_equal "$output" "\fmessage{ id:msg-$(printf "%03d" $first)@notmuch-test-suite depth:0 match:1 filename:/XXX/mail/msg-$(printf "%03d" $first)
71 \fheader{
72 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (unread)
73 Subject: thread-naming: Initial thread subject
74 From: Notmuch Test Suite <test_suite@notmuchmail.org>
75 To: Notmuch Test Suite <test_suite@notmuchmail.org>
76 Date: Fri, 05 Jan 2001 15:43:56 -0000
77 \fheader}
78 \fbody{
79 \fpart{ ID: 1, Content-type: text/plain
80 This is just a test message (#$first)
81 \fpart}
82 \fbody}
83 \fmessage}
84 \fmessage{ id:msg-$(printf "%03d" $((first + 1)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 1)))
85 \fheader{
86 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-06) (inbox unread)
87 Subject: thread-naming: Older changed subject
88 From: Notmuch Test Suite <test_suite@notmuchmail.org>
89 To: Notmuch Test Suite <test_suite@notmuchmail.org>
90 Date: Sat, 06 Jan 2001 15:43:56 -0000
91 \fheader}
92 \fbody{
93 \fpart{ ID: 1, Content-type: text/plain
94 This is just a test message (#$((first + 1)))
95 \fpart}
96 \fbody}
97 \fmessage}
98 \fmessage{ id:msg-$(printf "%03d" $((first + 2)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 2)))
99 \fheader{
100 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-07) (inbox unread)
101 Subject: thread-naming: Newer changed subject
102 From: Notmuch Test Suite <test_suite@notmuchmail.org>
103 To: Notmuch Test Suite <test_suite@notmuchmail.org>
104 Date: Sun, 07 Jan 2001 15:43:56 -0000
105 \fheader}
106 \fbody{
107 \fpart{ ID: 1, Content-type: text/plain
108 This is just a test message (#$((first + 2)))
109 \fpart}
110 \fbody}
111 \fmessage}
112 \fmessage{ id:msg-$(printf "%03d" $((first + 3)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 3)))
113 \fheader{
114 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-08) (unread)
115 Subject: thread-naming: Final thread subject
116 From: Notmuch Test Suite <test_suite@notmuchmail.org>
117 To: Notmuch Test Suite <test_suite@notmuchmail.org>
118 Date: Mon, 08 Jan 2001 15:43:56 -0000
119 \fheader}
120 \fbody{
121 \fpart{ ID: 1, Content-type: text/plain
122 This is just a test message (#$((first + 3)))
123 \fpart}
124 \fbody}
125 \fmessage}
126 \fmessage{ id:msg-$(printf "%03d" $((first + 4)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 4)))
127 \fheader{
128 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-09) (inbox unread)
129 Subject: Re: thread-naming: Initial thread subject
130 From: Notmuch Test Suite <test_suite@notmuchmail.org>
131 To: Notmuch Test Suite <test_suite@notmuchmail.org>
132 Date: Tue, 09 Jan 2001 15:43:45 -0000
133 \fheader}
134 \fbody{
135 \fpart{ ID: 1, Content-type: text/plain
136 This is just a test message (#$((first + 4)))
137 \fpart}
138 \fbody}
139 \fmessage}
140 \fmessage{ id:msg-$(printf "%03d" $((first + 5)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 5)))
141 \fheader{
142 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-10) (inbox unread)
143 Subject: Aw: thread-naming: Initial thread subject
144 From: Notmuch Test Suite <test_suite@notmuchmail.org>
145 To: Notmuch Test Suite <test_suite@notmuchmail.org>
146 Date: Wed, 10 Jan 2001 15:43:45 -0000
147 \fheader}
148 \fbody{
149 \fpart{ ID: 1, Content-type: text/plain
150 This is just a test message (#$((first + 5)))
151 \fpart}
152 \fbody}
153 \fmessage}
154 \fmessage{ id:msg-$(printf "%03d" $((first + 6)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 6)))
155 \fheader{
156 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-11) (inbox unread)
157 Subject: Vs: thread-naming: Initial thread subject
158 From: Notmuch Test Suite <test_suite@notmuchmail.org>
159 To: Notmuch Test Suite <test_suite@notmuchmail.org>
160 Date: Thu, 11 Jan 2001 15:43:45 -0000
161 \fheader}
162 \fbody{
163 \fpart{ ID: 1, Content-type: text/plain
164 This is just a test message (#$((first + 6)))
165 \fpart}
166 \fbody}
167 \fmessage}
168 \fmessage{ id:msg-$(printf "%03d" $((first + 7)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 7)))
169 \fheader{
170 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-12) (inbox unread)
171 Subject: Sv: thread-naming: Initial thread subject
172 From: Notmuch Test Suite <test_suite@notmuchmail.org>
173 To: Notmuch Test Suite <test_suite@notmuchmail.org>
174 Date: Fri, 12 Jan 2001 15:43:45 -0000
175 \fheader}
176 \fbody{
177 \fpart{ ID: 1, Content-type: text/plain
178 This is just a test message (#$((first + 7)))
179 \fpart}
180 \fbody}
181 \fmessage}"
182 test_done