]> git.notmuchmail.org Git - notmuch/blob - test/search-output
ef870bf79cdd0467f1c3625d07cda4b1381da5fe
[notmuch] / test / search-output
1 #!/usr/bin/env bash
2 test_description='various settings for "notmuch search --output="'
3 . ./test-lib.sh
4
5 add_email_corpus
6
7 test_begin_subtest "notmuch search --output=threads"
8 output=$(notmuch search --output=threads '*' | sed -e s/thread:.*/thread:THREADID/)
9 test_expect_equal "$output" "thread:THREADID
10 thread:THREADID
11 thread:THREADID
12 thread:THREADID
13 thread:THREADID
14 thread:THREADID
15 thread:THREADID
16 thread:THREADID
17 thread:THREADID
18 thread:THREADID
19 thread:THREADID
20 thread:THREADID
21 thread:THREADID
22 thread:THREADID
23 thread:THREADID
24 thread:THREADID
25 thread:THREADID
26 thread:THREADID
27 thread:THREADID
28 thread:THREADID
29 thread:THREADID
30 thread:THREADID"
31
32 test_begin_subtest "notmuch search --format=json --output=threads"
33 output=$(notmuch search --format=json --output=threads '*' | sed -e s/\".*\"/\"THREADID\"/)
34 test_expect_equal "$output" '["THREADID",
35 "THREADID",
36 "THREADID",
37 "THREADID",
38 "THREADID",
39 "THREADID",
40 "THREADID",
41 "THREADID",
42 "THREADID",
43 "THREADID",
44 "THREADID",
45 "THREADID",
46 "THREADID",
47 "THREADID",
48 "THREADID",
49 "THREADID",
50 "THREADID",
51 "THREADID",
52 "THREADID",
53 "THREADID",
54 "THREADID",
55 "THREADID"]'
56
57 test_begin_subtest "notmuch search --output=messages"
58 output=$(notmuch search --output=messages '*')
59 test_expect_equal "$output" "id:1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk
60 id:877htoqdbo.fsf@yoom.home.cworth.org
61 id:878we4qdqf.fsf@yoom.home.cworth.org
62 id:87aaykqe24.fsf@yoom.home.cworth.org
63 id:87bpj0qeng.fsf@yoom.home.cworth.org
64 id:87fx8cqf8v.fsf@yoom.home.cworth.org
65 id:87hbssqfix.fsf@yoom.home.cworth.org
66 id:87iqd8qgiz.fsf@yoom.home.cworth.org
67 id:87k4xoqgnl.fsf@yoom.home.cworth.org
68 id:87ocn0qh6d.fsf@yoom.home.cworth.org
69 id:87pr7gqidx.fsf@yoom.home.cworth.org
70 id:867hto2p0t.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
71 id:1258532999-9316-1-git-send-email-keithp@keithp.com
72 id:86aayk2rbj.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
73 id:86d43g2w3y.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
74 id:ddd65cda0911172214t60d22b63hcfeb5a19ab54a39b@mail.gmail.com
75 id:86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
76 id:736613.51770.qm@web113505.mail.gq1.yahoo.com
77 id:1258520223-15328-1-git-send-email-jan@ryngle.com
78 id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com
79 id:1258510940-7018-1-git-send-email-stewart@flamingspork.com
80 id:yunzl6kd1w0.fsf@aiko.keithp.com
81 id:yun1vjwegii.fsf@aiko.keithp.com
82 id:yun3a4cegoa.fsf@aiko.keithp.com
83 id:1258509400-32511-1-git-send-email-stewart@flamingspork.com
84 id:1258506353-20352-1-git-send-email-stewart@flamingspork.com
85 id:20091118010116.GC25380@dottiness.seas.harvard.edu
86 id:20091118005829.GB25380@dottiness.seas.harvard.edu
87 id:20091118005040.GA25380@dottiness.seas.harvard.edu
88 id:cf0c4d610911171623q3e27a0adx802e47039b57604b@mail.gmail.com
89 id:1258500222-32066-1-git-send-email-ingmar@exherbo.org
90 id:20091117232137.GA7669@griffis1.net
91 id:20091118002059.067214ed@hikari
92 id:1258498485-sup-142@elly
93 id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com
94 id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com
95 id:1258496327-12086-1-git-send-email-jan@ryngle.com
96 id:1258493565-13508-1-git-send-email-keithp@keithp.com
97 id:yunaayketfm.fsf@aiko.keithp.com
98 id:yunbpj0etua.fsf@aiko.keithp.com
99 id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net
100 id:87fx8can9z.fsf@vertex.dottedmag
101 id:20091117203301.GV3165@dottiness.seas.harvard.edu
102 id:87lji4lx9v.fsf@yoom.home.cworth.org
103 id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com
104 id:87iqd9rn3l.fsf@vertex.dottedmag
105 id:20091117190054.GU3165@dottiness.seas.harvard.edu
106 id:87lji5cbwo.fsf@yoom.home.cworth.org
107 id:1258471718-6781-2-git-send-email-dottedmag@dottedmag.net
108 id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net"
109
110 test_begin_subtest "notmuch search --format=json --output=messages"
111 output=$(notmuch search --format=json --output=messages '*')
112 test_expect_equal "$output" '["1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk",
113 "877htoqdbo.fsf@yoom.home.cworth.org",
114 "878we4qdqf.fsf@yoom.home.cworth.org",
115 "87aaykqe24.fsf@yoom.home.cworth.org",
116 "87bpj0qeng.fsf@yoom.home.cworth.org",
117 "87fx8cqf8v.fsf@yoom.home.cworth.org",
118 "87hbssqfix.fsf@yoom.home.cworth.org",
119 "87iqd8qgiz.fsf@yoom.home.cworth.org",
120 "87k4xoqgnl.fsf@yoom.home.cworth.org",
121 "87ocn0qh6d.fsf@yoom.home.cworth.org",
122 "87pr7gqidx.fsf@yoom.home.cworth.org",
123 "867hto2p0t.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me",
124 "1258532999-9316-1-git-send-email-keithp@keithp.com",
125 "86aayk2rbj.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me",
126 "86d43g2w3y.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me",
127 "ddd65cda0911172214t60d22b63hcfeb5a19ab54a39b@mail.gmail.com",
128 "86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me",
129 "736613.51770.qm@web113505.mail.gq1.yahoo.com",
130 "1258520223-15328-1-git-send-email-jan@ryngle.com",
131 "ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com",
132 "1258510940-7018-1-git-send-email-stewart@flamingspork.com",
133 "yunzl6kd1w0.fsf@aiko.keithp.com",
134 "yun1vjwegii.fsf@aiko.keithp.com",
135 "yun3a4cegoa.fsf@aiko.keithp.com",
136 "1258509400-32511-1-git-send-email-stewart@flamingspork.com",
137 "1258506353-20352-1-git-send-email-stewart@flamingspork.com",
138 "20091118010116.GC25380@dottiness.seas.harvard.edu",
139 "20091118005829.GB25380@dottiness.seas.harvard.edu",
140 "20091118005040.GA25380@dottiness.seas.harvard.edu",
141 "cf0c4d610911171623q3e27a0adx802e47039b57604b@mail.gmail.com",
142 "1258500222-32066-1-git-send-email-ingmar@exherbo.org",
143 "20091117232137.GA7669@griffis1.net",
144 "20091118002059.067214ed@hikari",
145 "1258498485-sup-142@elly",
146 "f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com",
147 "f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com",
148 "1258496327-12086-1-git-send-email-jan@ryngle.com",
149 "1258493565-13508-1-git-send-email-keithp@keithp.com",
150 "yunaayketfm.fsf@aiko.keithp.com",
151 "yunbpj0etua.fsf@aiko.keithp.com",
152 "1258491078-29658-1-git-send-email-dottedmag@dottedmag.net",
153 "87fx8can9z.fsf@vertex.dottedmag",
154 "20091117203301.GV3165@dottiness.seas.harvard.edu",
155 "87lji4lx9v.fsf@yoom.home.cworth.org",
156 "cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com",
157 "87iqd9rn3l.fsf@vertex.dottedmag",
158 "20091117190054.GU3165@dottiness.seas.harvard.edu",
159 "87lji5cbwo.fsf@yoom.home.cworth.org",
160 "1258471718-6781-2-git-send-email-dottedmag@dottedmag.net",
161 "1258471718-6781-1-git-send-email-dottedmag@dottedmag.net"]'
162
163 test_begin_subtest "notmuch search --output=files"
164 output=$(notmuch search --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR,")
165 test_expect_equal "$output" "MAIL_DIR/cur/50:2,
166 MAIL_DIR/cur/49:2,
167 MAIL_DIR/cur/48:2,
168 MAIL_DIR/cur/47:2,
169 MAIL_DIR/cur/46:2,
170 MAIL_DIR/cur/45:2,
171 MAIL_DIR/cur/44:2,
172 MAIL_DIR/cur/43:2,
173 MAIL_DIR/cur/42:2,
174 MAIL_DIR/cur/41:2,
175 MAIL_DIR/cur/40:2,
176 MAIL_DIR/cur/39:2,
177 MAIL_DIR/cur/38:2,
178 MAIL_DIR/cur/37:2,
179 MAIL_DIR/cur/36:2,
180 MAIL_DIR/cur/35:2,
181 MAIL_DIR/cur/34:2,
182 MAIL_DIR/cur/33:2,
183 MAIL_DIR/cur/32:2,
184 MAIL_DIR/cur/31:2,
185 MAIL_DIR/cur/30:2,
186 MAIL_DIR/cur/29:2,
187 MAIL_DIR/cur/28:2,
188 MAIL_DIR/cur/27:2,
189 MAIL_DIR/cur/26:2,
190 MAIL_DIR/cur/25:2,
191 MAIL_DIR/cur/24:2,
192 MAIL_DIR/cur/23:2,
193 MAIL_DIR/cur/22:2,
194 MAIL_DIR/cur/21:2,
195 MAIL_DIR/cur/19:2,
196 MAIL_DIR/cur/18:2,
197 MAIL_DIR/cur/20:2,
198 MAIL_DIR/cur/17:2,
199 MAIL_DIR/cur/16:2,
200 MAIL_DIR/cur/15:2,
201 MAIL_DIR/cur/14:2,
202 MAIL_DIR/cur/13:2,
203 MAIL_DIR/cur/12:2,
204 MAIL_DIR/cur/11:2,
205 MAIL_DIR/cur/10:2,
206 MAIL_DIR/cur/09:2,
207 MAIL_DIR/cur/08:2,
208 MAIL_DIR/cur/06:2,
209 MAIL_DIR/cur/05:2,
210 MAIL_DIR/cur/04:2,
211 MAIL_DIR/cur/03:2,
212 MAIL_DIR/cur/07:2,
213 MAIL_DIR/cur/02:2,
214 MAIL_DIR/cur/01:2,"
215
216 test_begin_subtest "notmuch search --format=json --output=files"
217 output=$(notmuch search --format=json --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR,")
218 test_expect_equal "$output" '["MAIL_DIR/cur/50:2,",
219 "MAIL_DIR/cur/49:2,",
220 "MAIL_DIR/cur/48:2,",
221 "MAIL_DIR/cur/47:2,",
222 "MAIL_DIR/cur/46:2,",
223 "MAIL_DIR/cur/45:2,",
224 "MAIL_DIR/cur/44:2,",
225 "MAIL_DIR/cur/43:2,",
226 "MAIL_DIR/cur/42:2,",
227 "MAIL_DIR/cur/41:2,",
228 "MAIL_DIR/cur/40:2,",
229 "MAIL_DIR/cur/39:2,",
230 "MAIL_DIR/cur/38:2,",
231 "MAIL_DIR/cur/37:2,",
232 "MAIL_DIR/cur/36:2,",
233 "MAIL_DIR/cur/35:2,",
234 "MAIL_DIR/cur/34:2,",
235 "MAIL_DIR/cur/33:2,",
236 "MAIL_DIR/cur/32:2,",
237 "MAIL_DIR/cur/31:2,",
238 "MAIL_DIR/cur/30:2,",
239 "MAIL_DIR/cur/29:2,",
240 "MAIL_DIR/cur/28:2,",
241 "MAIL_DIR/cur/27:2,",
242 "MAIL_DIR/cur/26:2,",
243 "MAIL_DIR/cur/25:2,",
244 "MAIL_DIR/cur/24:2,",
245 "MAIL_DIR/cur/23:2,",
246 "MAIL_DIR/cur/22:2,",
247 "MAIL_DIR/cur/21:2,",
248 "MAIL_DIR/cur/19:2,",
249 "MAIL_DIR/cur/18:2,",
250 "MAIL_DIR/cur/20:2,",
251 "MAIL_DIR/cur/17:2,",
252 "MAIL_DIR/cur/16:2,",
253 "MAIL_DIR/cur/15:2,",
254 "MAIL_DIR/cur/14:2,",
255 "MAIL_DIR/cur/13:2,",
256 "MAIL_DIR/cur/12:2,",
257 "MAIL_DIR/cur/11:2,",
258 "MAIL_DIR/cur/10:2,",
259 "MAIL_DIR/cur/09:2,",
260 "MAIL_DIR/cur/08:2,",
261 "MAIL_DIR/cur/06:2,",
262 "MAIL_DIR/cur/05:2,",
263 "MAIL_DIR/cur/04:2,",
264 "MAIL_DIR/cur/03:2,",
265 "MAIL_DIR/cur/07:2,",
266 "MAIL_DIR/cur/02:2,",
267 "MAIL_DIR/cur/01:2,"]'
268
269 test_begin_subtest "notmuch search --output=tags"
270 output=$(notmuch search --output=tags '*')
271 test_expect_equal "$output" "attachment
272 inbox
273 unread"
274
275 test_begin_subtest "notmuch search --format=json --output=tags"
276 output=$(notmuch search --format=json --output=tags '*')
277 test_expect_equal "$output" '["attachment",
278 "inbox",
279 "unread"]'
280
281 test_done