test: Add simple tests for "notmuch search --output=<>"
[notmuch] / test / search-output
1 #!/bin/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 --output=messages"
33 output=$(notmuch search --output=messages '*')
34 test_expect_equal "$output" "id:1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk
35 id:877htoqdbo.fsf@yoom.home.cworth.org
36 id:878we4qdqf.fsf@yoom.home.cworth.org
37 id:87aaykqe24.fsf@yoom.home.cworth.org
38 id:87bpj0qeng.fsf@yoom.home.cworth.org
39 id:87fx8cqf8v.fsf@yoom.home.cworth.org
40 id:87hbssqfix.fsf@yoom.home.cworth.org
41 id:87iqd8qgiz.fsf@yoom.home.cworth.org
42 id:87k4xoqgnl.fsf@yoom.home.cworth.org
43 id:87ocn0qh6d.fsf@yoom.home.cworth.org
44 id:87pr7gqidx.fsf@yoom.home.cworth.org
45 id:867hto2p0t.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
46 id:1258532999-9316-1-git-send-email-keithp@keithp.com
47 id:86aayk2rbj.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
48 id:86d43g2w3y.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
49 id:ddd65cda0911172214t60d22b63hcfeb5a19ab54a39b@mail.gmail.com
50 id:86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me
51 id:736613.51770.qm@web113505.mail.gq1.yahoo.com
52 id:1258520223-15328-1-git-send-email-jan@ryngle.com
53 id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com
54 id:1258510940-7018-1-git-send-email-stewart@flamingspork.com
55 id:yunzl6kd1w0.fsf@aiko.keithp.com
56 id:yun1vjwegii.fsf@aiko.keithp.com
57 id:yun3a4cegoa.fsf@aiko.keithp.com
58 id:1258509400-32511-1-git-send-email-stewart@flamingspork.com
59 id:1258506353-20352-1-git-send-email-stewart@flamingspork.com
60 id:20091118010116.GC25380@dottiness.seas.harvard.edu
61 id:20091118005829.GB25380@dottiness.seas.harvard.edu
62 id:20091118005040.GA25380@dottiness.seas.harvard.edu
63 id:cf0c4d610911171623q3e27a0adx802e47039b57604b@mail.gmail.com
64 id:1258500222-32066-1-git-send-email-ingmar@exherbo.org
65 id:20091117232137.GA7669@griffis1.net
66 id:20091118002059.067214ed@hikari
67 id:1258498485-sup-142@elly
68 id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com
69 id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com
70 id:1258496327-12086-1-git-send-email-jan@ryngle.com
71 id:1258493565-13508-1-git-send-email-keithp@keithp.com
72 id:yunaayketfm.fsf@aiko.keithp.com
73 id:yunbpj0etua.fsf@aiko.keithp.com
74 id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net
75 id:87fx8can9z.fsf@vertex.dottedmag
76 id:20091117203301.GV3165@dottiness.seas.harvard.edu
77 id:87lji4lx9v.fsf@yoom.home.cworth.org
78 id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com
79 id:87iqd9rn3l.fsf@vertex.dottedmag
80 id:20091117190054.GU3165@dottiness.seas.harvard.edu
81 id:87lji5cbwo.fsf@yoom.home.cworth.org
82 id:1258471718-6781-2-git-send-email-dottedmag@dottedmag.net
83 id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net"
84
85 test_begin_subtest "notmuch search --output=files"
86 output=$(notmuch search --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR,")
87 test_expect_equal "$output" "MAIL_DIR/cur/50:2,
88 MAIL_DIR/cur/49:2,
89 MAIL_DIR/cur/48:2,
90 MAIL_DIR/cur/47:2,
91 MAIL_DIR/cur/46:2,
92 MAIL_DIR/cur/45:2,
93 MAIL_DIR/cur/44:2,
94 MAIL_DIR/cur/43:2,
95 MAIL_DIR/cur/42:2,
96 MAIL_DIR/cur/41:2,
97 MAIL_DIR/cur/40:2,
98 MAIL_DIR/cur/39:2,
99 MAIL_DIR/cur/38:2,
100 MAIL_DIR/cur/37:2,
101 MAIL_DIR/cur/36:2,
102 MAIL_DIR/cur/35:2,
103 MAIL_DIR/cur/34:2,
104 MAIL_DIR/cur/33:2,
105 MAIL_DIR/cur/32:2,
106 MAIL_DIR/cur/31:2,
107 MAIL_DIR/cur/30:2,
108 MAIL_DIR/cur/29:2,
109 MAIL_DIR/cur/28:2,
110 MAIL_DIR/cur/27:2,
111 MAIL_DIR/cur/26:2,
112 MAIL_DIR/cur/25:2,
113 MAIL_DIR/cur/24:2,
114 MAIL_DIR/cur/23:2,
115 MAIL_DIR/cur/22:2,
116 MAIL_DIR/cur/21:2,
117 MAIL_DIR/cur/19:2,
118 MAIL_DIR/cur/18:2,
119 MAIL_DIR/cur/20:2,
120 MAIL_DIR/cur/17:2,
121 MAIL_DIR/cur/16:2,
122 MAIL_DIR/cur/15:2,
123 MAIL_DIR/cur/14:2,
124 MAIL_DIR/cur/13:2,
125 MAIL_DIR/cur/12:2,
126 MAIL_DIR/cur/11:2,
127 MAIL_DIR/cur/10:2,
128 MAIL_DIR/cur/09:2,
129 MAIL_DIR/cur/08:2,
130 MAIL_DIR/cur/06:2,
131 MAIL_DIR/cur/05:2,
132 MAIL_DIR/cur/04:2,
133 MAIL_DIR/cur/03:2,
134 MAIL_DIR/cur/07:2,
135 MAIL_DIR/cur/02:2,
136 MAIL_DIR/cur/01:2,"
137
138 test_begin_subtest "notmuch search --output=tags"
139 output=$(notmuch search --output=tags '*')
140 test_expect_equal "$output" "attachment
141 inbox
142 unread"
143
144 test_done