aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/thread-naming
blob: 1a1a48f6f5b92c88b479f0b7825b79ee22c6879a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/usr/bin/env bash
test_description="naming of threads with changing subject"
. ./test-lib.sh

test_begin_subtest "Initial thread name (oldest-first search)"
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}
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 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $first)
header{
Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (unread)
Subject: thread-naming: Initial thread subject
From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
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 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 1)))
header{
Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-06) (inbox unread)
Subject: thread-naming: Older changed subject
From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
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 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 2)))
header{
Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-07) (inbox unread)
Subject: thread-naming: Newer changed subject
From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
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 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 3)))
header{
Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-08) (unread)
Subject: thread-naming: Final thread subject
From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
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 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 4)))
header{
Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-09) (inbox unread)
Subject: Re: thread-naming: Initial thread subject
From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
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 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 5)))
header{
Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-10) (inbox unread)
Subject: Aw: thread-naming: Initial thread subject
From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
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 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 6)))
header{
Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-11) (inbox unread)
Subject: Vs: thread-naming: Initial thread subject
From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
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 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 7)))
header{
Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-12) (inbox unread)
Subject: Sv: thread-naming: Initial thread subject
From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
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