unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob c2a87eb1ca27ceed2d9b290e26bc1efef65bf89c 10382 bytes (raw)
name: test/search-output 	 # note: path name is non-authoritative(*)

  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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
 
#!/usr/bin/env bash
test_description='various settings for "notmuch search --output="'
. ./test-lib.sh

add_email_corpus

test_begin_subtest "--output=threads"
notmuch search --output=threads '*' | sed -e s/thread:.*/thread:THREADID/ >OUTPUT
cat <<EOF >EXPECTED
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
EOF
test_expect_equal_file OUTPUT EXPECTED

test_begin_subtest "--output=threads --format=json"
notmuch search --format=json --output=threads '*' | sed -e s/\".*\"/\"THREADID\"/ >OUTPUT
cat <<EOF >EXPECTED
["THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID",
"THREADID"]
EOF
test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"

test_begin_subtest "--output=messages"
notmuch search --output=messages '*' >OUTPUT
cat <<EOF >EXPECTED
id:4EFC743A.3060609@april.org
id:877h1wv7mg.fsf@inf-8657.int-evry.fr
id:1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk
id:877htoqdbo.fsf@yoom.home.cworth.org
id:878we4qdqf.fsf@yoom.home.cworth.org
id:87aaykqe24.fsf@yoom.home.cworth.org
id:87bpj0qeng.fsf@yoom.home.cworth.org
id:87fx8cqf8v.fsf@yoom.home.cworth.org
id:87hbssqfix.fsf@yoom.home.cworth.org
id:87iqd8qgiz.fsf@yoom.home.cworth.org
id:87k4xoqgnl.fsf@yoom.home.cworth.org
id:87ocn0qh6d.fsf@yoom.home.cworth.org
id:87pr7gqidx.fsf@yoom.home.cworth.org
id:867hto2p0t.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
id:1258532999-9316-1-git-send-email-keithp@keithp.com
id:86aayk2rbj.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
id:86d43g2w3y.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
id:ddd65cda0911172214t60d22b63hcfeb5a19ab54a39b@mail.gmail.com
id:86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
id:736613.51770.qm@web113505.mail.gq1.yahoo.com
id:1258520223-15328-1-git-send-email-jan@ryngle.com
id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com
id:1258510940-7018-1-git-send-email-stewart@flamingspork.com
id:yunzl6kd1w0.fsf@aiko.keithp.com
id:yun1vjwegii.fsf@aiko.keithp.com
id:yun3a4cegoa.fsf@aiko.keithp.com
id:1258509400-32511-1-git-send-email-stewart@flamingspork.com
id:1258506353-20352-1-git-send-email-stewart@flamingspork.com
id:20091118010116.GC25380@dottiness.seas.harvard.edu
id:20091118005829.GB25380@dottiness.seas.harvard.edu
id:20091118005040.GA25380@dottiness.seas.harvard.edu
id:cf0c4d610911171623q3e27a0adx802e47039b57604b@mail.gmail.com
id:1258500222-32066-1-git-send-email-ingmar@exherbo.org
id:20091117232137.GA7669@griffis1.net
id:20091118002059.067214ed@hikari
id:1258498485-sup-142@elly
id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com
id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com
id:1258496327-12086-1-git-send-email-jan@ryngle.com
id:1258493565-13508-1-git-send-email-keithp@keithp.com
id:yunaayketfm.fsf@aiko.keithp.com
id:yunbpj0etua.fsf@aiko.keithp.com
id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net
id:87fx8can9z.fsf@vertex.dottedmag
id:20091117203301.GV3165@dottiness.seas.harvard.edu
id:87lji4lx9v.fsf@yoom.home.cworth.org
id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com
id:87iqd9rn3l.fsf@vertex.dottedmag
id:20091117190054.GU3165@dottiness.seas.harvard.edu
id:87lji5cbwo.fsf@yoom.home.cworth.org
id:1258471718-6781-2-git-send-email-dottedmag@dottedmag.net
id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net
EOF
test_expect_equal_file OUTPUT EXPECTED

test_begin_subtest "--output=messages --format=json"
notmuch search --format=json --output=messages '*' >OUTPUT
cat <<EOF >EXPECTED
["4EFC743A.3060609@april.org",
"877h1wv7mg.fsf@inf-8657.int-evry.fr",
"1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk",
"877htoqdbo.fsf@yoom.home.cworth.org",
"878we4qdqf.fsf@yoom.home.cworth.org",
"87aaykqe24.fsf@yoom.home.cworth.org",
"87bpj0qeng.fsf@yoom.home.cworth.org",
"87fx8cqf8v.fsf@yoom.home.cworth.org",
"87hbssqfix.fsf@yoom.home.cworth.org",
"87iqd8qgiz.fsf@yoom.home.cworth.org",
"87k4xoqgnl.fsf@yoom.home.cworth.org",
"87ocn0qh6d.fsf@yoom.home.cworth.org",
"87pr7gqidx.fsf@yoom.home.cworth.org",
"867hto2p0t.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me",
"1258532999-9316-1-git-send-email-keithp@keithp.com",
"86aayk2rbj.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me",
"86d43g2w3y.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me",
"ddd65cda0911172214t60d22b63hcfeb5a19ab54a39b@mail.gmail.com",
"86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me",
"736613.51770.qm@web113505.mail.gq1.yahoo.com",
"1258520223-15328-1-git-send-email-jan@ryngle.com",
"ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com",
"1258510940-7018-1-git-send-email-stewart@flamingspork.com",
"yunzl6kd1w0.fsf@aiko.keithp.com",
"yun1vjwegii.fsf@aiko.keithp.com",
"yun3a4cegoa.fsf@aiko.keithp.com",
"1258509400-32511-1-git-send-email-stewart@flamingspork.com",
"1258506353-20352-1-git-send-email-stewart@flamingspork.com",
"20091118010116.GC25380@dottiness.seas.harvard.edu",
"20091118005829.GB25380@dottiness.seas.harvard.edu",
"20091118005040.GA25380@dottiness.seas.harvard.edu",
"cf0c4d610911171623q3e27a0adx802e47039b57604b@mail.gmail.com",
"1258500222-32066-1-git-send-email-ingmar@exherbo.org",
"20091117232137.GA7669@griffis1.net",
"20091118002059.067214ed@hikari",
"1258498485-sup-142@elly",
"f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com",
"f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com",
"1258496327-12086-1-git-send-email-jan@ryngle.com",
"1258493565-13508-1-git-send-email-keithp@keithp.com",
"yunaayketfm.fsf@aiko.keithp.com",
"yunbpj0etua.fsf@aiko.keithp.com",
"1258491078-29658-1-git-send-email-dottedmag@dottedmag.net",
"87fx8can9z.fsf@vertex.dottedmag",
"20091117203301.GV3165@dottiness.seas.harvard.edu",
"87lji4lx9v.fsf@yoom.home.cworth.org",
"cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com",
"87iqd9rn3l.fsf@vertex.dottedmag",
"20091117190054.GU3165@dottiness.seas.harvard.edu",
"87lji5cbwo.fsf@yoom.home.cworth.org",
"1258471718-6781-2-git-send-email-dottedmag@dottedmag.net",
"1258471718-6781-1-git-send-email-dottedmag@dottedmag.net"]
EOF
test_expect_equal_file OUTPUT EXPECTED

test_begin_subtest "--output=files"
notmuch search --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT
cat <<EOF >EXPECTED
MAIL_DIR/cur/52:2,
MAIL_DIR/cur/53:2,
MAIL_DIR/cur/50:2,
MAIL_DIR/cur/49:2,
MAIL_DIR/cur/48:2,
MAIL_DIR/cur/47:2,
MAIL_DIR/cur/46:2,
MAIL_DIR/cur/45:2,
MAIL_DIR/cur/44:2,
MAIL_DIR/cur/43:2,
MAIL_DIR/cur/42:2,
MAIL_DIR/cur/41:2,
MAIL_DIR/cur/40:2,
MAIL_DIR/cur/39:2,
MAIL_DIR/cur/38:2,
MAIL_DIR/cur/37:2,
MAIL_DIR/cur/36:2,
MAIL_DIR/cur/35:2,
MAIL_DIR/cur/34:2,
MAIL_DIR/cur/33:2,
MAIL_DIR/cur/32:2,
MAIL_DIR/cur/31:2,
MAIL_DIR/cur/30:2,
MAIL_DIR/cur/29:2,
MAIL_DIR/cur/28:2,
MAIL_DIR/cur/27:2,
MAIL_DIR/cur/26:2,
MAIL_DIR/cur/25:2,
MAIL_DIR/cur/24:2,
MAIL_DIR/cur/23:2,
MAIL_DIR/cur/22:2,
MAIL_DIR/cur/21:2,
MAIL_DIR/cur/19:2,
MAIL_DIR/cur/18:2,
MAIL_DIR/cur/51:2,
MAIL_DIR/cur/20:2,
MAIL_DIR/cur/17:2,
MAIL_DIR/cur/16:2,
MAIL_DIR/cur/15:2,
MAIL_DIR/cur/14:2,
MAIL_DIR/cur/13:2,
MAIL_DIR/cur/12:2,
MAIL_DIR/cur/11:2,
MAIL_DIR/cur/10:2,
MAIL_DIR/cur/09:2,
MAIL_DIR/cur/08:2,
MAIL_DIR/cur/06:2,
MAIL_DIR/cur/05:2,
MAIL_DIR/cur/04:2,
MAIL_DIR/cur/03:2,
MAIL_DIR/cur/07:2,
MAIL_DIR/cur/02:2,
MAIL_DIR/cur/01:2,
EOF
test_expect_equal_file OUTPUT EXPECTED

test_begin_subtest "--output=files --format=json"
notmuch search --format=json --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT
cat <<EOF >EXPECTED
["MAIL_DIR/cur/52:2,",
"MAIL_DIR/cur/53:2,",
"MAIL_DIR/cur/50:2,",
"MAIL_DIR/cur/49:2,",
"MAIL_DIR/cur/48:2,",
"MAIL_DIR/cur/47:2,",
"MAIL_DIR/cur/46:2,",
"MAIL_DIR/cur/45:2,",
"MAIL_DIR/cur/44:2,",
"MAIL_DIR/cur/43:2,",
"MAIL_DIR/cur/42:2,",
"MAIL_DIR/cur/41:2,",
"MAIL_DIR/cur/40:2,",
"MAIL_DIR/cur/39:2,",
"MAIL_DIR/cur/38:2,",
"MAIL_DIR/cur/37:2,",
"MAIL_DIR/cur/36:2,",
"MAIL_DIR/cur/35:2,",
"MAIL_DIR/cur/34:2,",
"MAIL_DIR/cur/33:2,",
"MAIL_DIR/cur/32:2,",
"MAIL_DIR/cur/31:2,",
"MAIL_DIR/cur/30:2,",
"MAIL_DIR/cur/29:2,",
"MAIL_DIR/cur/28:2,",
"MAIL_DIR/cur/27:2,",
"MAIL_DIR/cur/26:2,",
"MAIL_DIR/cur/25:2,",
"MAIL_DIR/cur/24:2,",
"MAIL_DIR/cur/23:2,",
"MAIL_DIR/cur/22:2,",
"MAIL_DIR/cur/21:2,",
"MAIL_DIR/cur/19:2,",
"MAIL_DIR/cur/18:2,",
"MAIL_DIR/cur/51:2,",
"MAIL_DIR/cur/20:2,",
"MAIL_DIR/cur/17:2,",
"MAIL_DIR/cur/16:2,",
"MAIL_DIR/cur/15:2,",
"MAIL_DIR/cur/14:2,",
"MAIL_DIR/cur/13:2,",
"MAIL_DIR/cur/12:2,",
"MAIL_DIR/cur/11:2,",
"MAIL_DIR/cur/10:2,",
"MAIL_DIR/cur/09:2,",
"MAIL_DIR/cur/08:2,",
"MAIL_DIR/cur/06:2,",
"MAIL_DIR/cur/05:2,",
"MAIL_DIR/cur/04:2,",
"MAIL_DIR/cur/03:2,",
"MAIL_DIR/cur/07:2,",
"MAIL_DIR/cur/02:2,",
"MAIL_DIR/cur/01:2,"]
EOF
test_expect_equal_file OUTPUT EXPECTED

test_begin_subtest "--output=tags"
notmuch search --output=tags '*' >OUTPUT
cat <<EOF >EXPECTED
attachment
inbox
signed
unread
EOF
test_expect_equal_file OUTPUT EXPECTED

test_begin_subtest "--output=tags --format=json"
notmuch search --format=json --output=tags '*' >OUTPUT
cat <<EOF >EXPECTED
["attachment",
"inbox",
"signed",
"unread"]
EOF
test_expect_equal_file OUTPUT EXPECTED

test_begin_subtest "sanitize output for quoted-printable line-breaks in author and subject"
add_message "[subject]='two =?ISO-8859-1?Q?line=0A_subject?=
	headers'"
notmuch search id:"$gen_msg_id" | notmuch_search_sanitize >OUTPUT
cat <<EOF >EXPECTED
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; two line? subject headers (inbox unread)
EOF
test_expect_equal_file OUTPUT EXPECTED

test_begin_subtest "search for non-existent message prints nothing"
notmuch search "no-message-matches-this" > OUTPUT
echo -n >EXPECTED
test_expect_equal_file OUTPUT EXPECTED

test_begin_subtest "search --format=json for non-existent message prints proper empty json"
notmuch search --format=json "no-message-matches-this" > OUTPUT
echo "[]" >EXPECTED
test_expect_equal_file OUTPUT EXPECTED

test_done

debug log:

solving c2a87eb ...
found c2a87eb in https://yhetil.org/notmuch.git/

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).