]>
diplodocus.org Git - nmh/blob - test/mhlist/test-mhlist
2 ######################################################
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname $0`/..
/..
12 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 .
"$MH_OBJ_DIR/test/common.sh"
19 check_exit
'-eq 1' mhlist
- # gcov
21 expected
=$MH_TEST_DIR/$$.expected
22 actual
=$MH_TEST_DIR/$$.actual
25 # check with no options and no current message
26 run_test
'mhlist' 'mhlist: no cur message'
28 # check with no options and current message
29 folder
+inbox
5 > /dev
/null
31 msg part type/subtype size description
34 run_prog mhlist
> $actual 2>&1
35 check
$expected $actual 'keep first'
38 run_test
'mhlist 5 -noheaders' ' 5 text/plain 25'
41 run_prog mhlist
-noheaders -headers > $actual 2>&1
42 check
$expected $actual 'keep first'
44 # check with folder and current message
45 run_prog mhlist
+inbox
> $actual 2>&1
46 check
$expected $actual 'keep first'
48 # check with specified message
49 run_prog mhlist
5 > $actual 2>&1
50 check
$expected $actual 'keep first'
53 run_prog mhlist
-file "$MH_TEST_DIR/Mail/inbox/5" > $actual 2>&1
54 check
$expected $actual
58 msg part type/subtype size description
61 run_prog mhlist
-file - < "$MH_TEST_DIR/Mail/inbox/5" > $actual 2>&1
62 check
$expected $actual
64 # check message number greater than highest
65 run_test
'mhlist 11' "mhlist: message 11 doesn't exist"
67 # check multiple messages
69 msg part type/subtype size description
73 run_prog mhlist
2 8 > $actual 2>&1
74 check
$expected $actual
76 # Write message with a text/plain subpart.
79 To: recipient@example.com
80 From: sender@example.com
83 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
86 Content-Type: multipart/related;
87 type="multipart/alternative";
88 boundary="subpart__1.1"
91 Content-Type: text/plain; charset="iso-8859-1"
92 Content-Disposition: attachment; filename="test1"
94 This is the first text/plain part, in a subpart.
99 Content-Type: text/plain; charset="iso-8859-1"
100 Content-Disposition: attachment; filename="test2"
101 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
102 Content-Transfer-Encoding: quoted-printable
104 This is the second text/plain part.
106 ------- =_aaaaaaaaaa0
107 Content-Type: text/plain; charset="iso-8859-1"; name="test3"
108 Content-Disposition: attachment; filename="test3"
110 This is the third text/plain part.
112 ------- =_aaaaaaaaaa0
113 Content-Type: text/plain; charset="iso-8859-1"
114 Content-Disposition: attachment; filename="test4"
115 Content-Transfer-Encoding: base64
117 VGhpcyBpcyB0aGUgZm91cnRoIHRleHQvcGxhaW4gcGFydC4K
119 ------- =_aaaaaaaaaa0--
123 run_test
'mhlist last -part 3 -noheader' \
124 ' 11 multipart/mixed 936
125 1 multipart/related 180
128 # check -part of a subpart
129 run_test
'mhlist last -part 1.1 -noheader' \
130 ' 11 multipart/mixed 936
131 1 multipart/related 180
135 run_test
'mhlist last -type text/plain -noheader' \
136 ' 11 multipart/mixed 936
137 1 multipart/related 180
144 run_test
'mhlist last -part 4 -noheader -norealsize' \
145 ' 11 multipart/mixed 936
146 1 multipart/related 180
149 # check -realsize, the default
150 run_test
'mhlist last -part 4 -noheader -norealsize -realsize' \
151 ' 11 multipart/mixed 936
152 1 multipart/related 180
156 run_test
'mhlist last -part 2 -noheader -check' \
157 ' 11 multipart/mixed 936
158 1 multipart/related 180
161 # check -check with bad MD5 checksum
162 sed 's/\(Content-MD5: \)kq+Hnc/\1BADBAD/' $msgfile > $MH_TEST_DIR/$$.tmp
163 mv -f $MH_TEST_DIR/$$.tmp
$msgfile
164 run_test
'mhlist last -part 2 -noheader -check' \
165 ' 11 multipart/mixed 936
166 1 multipart/related 180
168 mhlist: content integrity suspect (digest mismatch) -- continuing
169 (content text/plain in message 11, part 2)'
171 # check -nocheck, the default
172 run_test
'mhlist last -part 2 -noheader -check -nocheck' \
173 ' 11 multipart/mixed 936
174 1 multipart/related 180
178 # Set the cur sequence to 1 to test default behavior of changecur after
182 mark
1 -sequence cur
-add -zero
185 run_test
'mhlist 11 -verbose -noheader' \
186 ' 11 multipart/mixed 936
187 boundary="----- =_aaaaaaaaaa0"
188 1 multipart/related 180
189 type="multipart/alternative"
190 boundary="subpart__1.1"
199 charset="iso-8859-1"'
202 # Check default changecur behavior
205 run_test
'mark -sequence cur -list' 'cur: 11'
208 # Now test -nochangecur
211 mhlist
-nochangecur 1 >/dev
/null
213 run_test
'mark -sequence cur -list' 'cur: 11'
215 # check MIME parser and m_getfld
216 cat > $expected <<EOF
217 msg part type/subtype size description
218 12 multipart/related 204
219 1 multipart/alternative 74
225 msgnum
=`basename $msgfile`
227 To: recipient@example.com, recipient@example.com, recipient@example.com,
228 recipient@example.com, recipient@example.com, recipient@example.com,
229 recipient@example.com, recipient@example.com, recipient@example.com,
230 recipient@example.com, recipient@example.com, recipient@example.com,
231 recipient@example.com, recipient@example.com, recipient@example.com,
232 recipient@example.com, recipient@example.com, recipient@example.com,
233 recipient@example.com, recipient@example.com, recipient@example.com,
234 recipient@example.com, recipient@example.com, recipient@example.com,
235 recipient@example.com, recipient@example.com, recipient@example.com,
236 recipient@example.com, recipient@example.com, recipient@example.com,
237 recipient@example.com, recipient@example.com, recipient@example.com,
238 recipient@example.com, recipient@example.com, recipient@example.com,
239 recipient@example.com, recipient@example.com, recipient@example.com,
240 recipient@example.com, recipient@example.com, recipient@example.com,
241 recipient@example.com, recipient@example.com, recipient@example.com,
242 recipient@example.com, recipient@example.com, recipient@example.com,
243 recipient@example.com, recipient@example.com, recipient@example.com,
244 recipient@example.com, recipient@example.com, recipient@example.com,
245 recipient@example.com, recipient@example.com, recipient@example.com,
246 recipient@example.com, recipient@example.com, recipient@example.com,
247 recipient@example.com, recipient@example.com, recipient@example.com,
248 recipient@example.com, recipient@example.com, recipient@example.com,
249 recipient@example.com, recipient@example.com, recipient@example.com,
250 recipient@example.com, recipient@example.com, recipient@example.com,
251 recipient@example.com, recipient@example.com, recipient@example.com,
252 recipient@example.com, recipient@example.com, recipient@example.com,
253 recipient@example.com, recipient@example.com, recipient@example.com,
254 recipient@example.com, recipient@example.com, recipient@example.com,
255 recipient@example.com, recipient@example.com, recipient@example.com,
256 recipient@example.com, recipient@example.com, recipient@example.com,
257 recipient@example.com, recipient@example.com, recipient@example.com,
258 recipient@example.com, recipient@example.com, recipient@example.com,
259 recipient@example.com, recipient@example.com, recipient@example.com,
260 recipient@example.com, recipient@example.com, recipient@example.com,
261 recipient@example.com, recipient@example.com, recipient@example.com,
262 recipient@example.com, recipient@example.com, recipient@example.com,
263 recipient@example.com, recipient@example.com, recipient@example.com,
264 recipient@example.com, recipient@example.com, recipient@example.com,
265 recipient@example.com, recipient@example.com, recipient@example.com,
266 recipient@example.com, recipient@example.com, recipient@example.com,
267 recipient@example.com, recipient@example.com, recipient@example.com,
268 recipient@example.com, recipient@example.com, recipient@example.com,
269 recipient@example.com, recipient@example.com, recipient@example.com,
270 recipient@example.com, recipient@example.com, recipient@example.com,
271 recipient@example.com, recipient@example.com, recipient@example.com,
272 recipient@example.com, recipient@example.com, recipient@example.com,
273 recipient@example.com, recipient@example.com, recipient@example.com,
274 recipient@example.com, recipient@example.com, recipient@example.com,
275 recipient@example.com, recipient@example.com, recipient@example.com,
276 recipient@example.com, recipient@example.com, recipient@example.com,
277 recipient@example.com, recipient@example.com, recipient@example.com,
278 recipient@example.com, recipient@example.com, recipient@example.com,
279 recipient@example.com, recipient@example.com, recipient@example.com,
280 recipient@example.com, recipient@example.com, recipient@example.com,
281 recipient@example.com, recipient@example.com, recipient@example.com,
282 recipient@example.com, recipient@example.com, recipient@example.com,
283 recipient@example.com, recipient@example.com, recipient@example.com,
284 recipient@example.com, recipient@example.com, recipient@example.com,
285 recipient@example.com, recipient@example.com, recipient@example.com,
286 recipient@example.com, recipient@example.com, recipient@example.com,
287 recipient@example.com, recipient@example.com, recipient@example.com,
288 recipient@example.com, recipient@example.com, recipient@example.com,
289 recipient@example.com, recipient@example.com, recipient@example.com,
290 recipient@example.com, recipient@example.com, recipient@example.com,
291 recipient@example.com, recipient@example.com, recipient@example.com,
292 recipient@example.com, recipient@example.com, recipient@example.com,
293 recipient@example.com, recipient@example.com, recipient@example.com,
294 recipient@example.com, recipient@example.com, recipient@example.com,
295 recipient@example.com, recipient@example.com, recipient@example.com,
296 recipient@example.com, recipient@example.com, recipient@example.com,
297 recipient@example.com, recipient@example.com, recipient@example.com,
298 recipient@example.com, recipient@example.com, recipient@example.com,
299 recipient@example.com, recipient@example.com, recipient@example.com,
300 recipient@example.com, recipient@example.com, recipient@example.com,
301 recipient@example.com, recipient@example.com, recipient@example.com,
302 recipient@example.com, recipient@example.com, recipient@example.com,
303 recipient@example.com, recipient@example.com, recipient@example.com,
304 recipient@example.com, recipient@example.com, recipient@example.com,
305 recipient@example.com, recipient@example.com, recipient@example.com,
306 recipient@example.com, recipient@example.com, recipient@example.com,
307 recipient@example.com, recipient@example.com, recipient@example.com,
308 recipient@example.com, recipient@example.com, recipient@example.com,
309 recipient@example.com, recipient@example.com, recipient@example.com,
310 recipient@example.com, recipient@example.com, recipient@example.com,
311 recipient@example.com, recipient@example.com, recipient@example.com,
312 recipient@example.com, recipient@example.com, recipient@example.com,
313 recipient@example.com, recipient@example.com, recipient@example.com,
314 recipient@example.com, recipient@example.com, recipient@example.com,
315 recipient@example.com, recipient@example.com, recipient@example.com,
316 recipient@example.com, recipient@example.com, recipient@example.com,
317 recipient@example.com, recipient@example.com, recipient@example.com,
318 recipient@example.com, recipient@example.com, recipient@example.com,
319 recipient@example.com, recipient@example.com, recipient@example.com,
320 recipient@example.com, recipient@example.com, recipient@example.com,
321 recipient@example.com, recipient@example.com, recipient@example.com,
322 recipient@example.com, recipient@example.com, recipient@example.com,
323 recipient@example.com, recipient@example.com, recipient@example.com,
324 recipient@example.com, recipient@example.com, recipient@example.com,
325 recipient@example.com, recipient@example.com, recipient@example.com,
326 recipient@example.com, recipient@example.com, recipient@example.com,
327 recipient@example.com, recipient@example.com, recipient@example.com,
328 recipient@example.com, recipient@example.com, recipient@example.com,
329 recipient@example.com, recipient@example.com, recipient@example.com,
330 recipient@example.com, recipient@example.com, recipient@example.com,
331 recipient@example.com, recipient@example.com, recipient@example.com,
332 recipient@example.com, recipient@example.com, recipient@example.com,
333 recipient@example.com, recipient@example.com, recipient@example.com,
334 recipient@example.com, recipient@example.com, recipient@example.com,
335 recipient@example.com, recipient@example.com, recipient@example.com,
336 recipient@example.com, recipient@example.com, recipient@example.com,
337 recipient@example.com, recipient@example.com, recipient@example.com,
338 recipient@example.com, recipient@example.com, recipient@example.com,
340 From: sender@example.com
341 Subject: very long header
342 Date: Wed, 4 Dec 2013 21:12:00 -0500
344 Content-Type: multipart/related; boundary="1"
347 Content-Type: multipart/alternative; boundary="2"
350 Content-Type: text/plain; charset="us-ascii"
358 Content-Type: text/plain; charset="us-ascii"
366 run_prog mhlist last
> $actual 2>&1
367 check
$expected $actual
369 ## now check mhlist output
372 msgnum
=`basename $msgfile`
374 To: example@example.org
375 From: someone <someone@example.com>
377 Date: Thu, 29 Jan 2015 18:12:21 +0000 (GMT)
378 Content-Type: multipart/mixed; boundary="BoundaryMixed"
381 Content-type: multipart/alternative;
382 boundary="BoundaryAlternative1"
384 --BoundaryAlternative1
385 Content-type: text/enriched; CHARSET=US-ASCII
386 Content-transfer-encoding: 7bit
388 This is supposedly enriched.
390 --BoundaryAlternative1
391 Content-type: text/plain; charset=ISO-8859-1; format=flowed
392 Content-transfer-encoding: 8bit
394 This is the body text/plain part.
396 --BoundaryAlternative1
397 Content-type: text/html; CHARSET=US-ASCII
398 Content-transfer-encoding: 7bit
400 <html><body><div><span style="line-height: 1.5;">
401 This is the text/html body part.
402 </span></div></body></html>
404 --BoundaryAlternative1--
407 Content-type: multipart/alternative;
408 boundary="BoundaryAlternative2"
410 --BoundaryAlternative2
411 Content-type: audio/wav
412 Content-transfer-encoding: 8bit
416 --BoundaryAlternative2
417 Content-type: audio/mp3
418 Content-transfer-encoding: 8bit
422 --BoundaryAlternative2
423 Content-type: audio/basic
424 Content-transfer-encoding: 8bit
428 --BoundaryAlternative2--
433 # Write the expected output.
434 cat > $expected <<EOF
435 msg part type/subtype size description
436 13 multipart/mixed 1038
437 1 multipart/alternative 518
441 2 multipart/alternative 326
447 # check it -- vanilla output
448 run_prog mhlist
$msgnum > $actual 2>&1
449 check
"$expected" "$actual"
451 # Write the expected output.
452 cat > $expected <<EOF
453 msg part type/subtype size description
454 13 multipart/mixed 1038
455 1 multipart/alternative 518
459 2 multipart/alternative 326
462 # check it -- just part 1
463 run_prog mhlist
-part 1 $msgnum > $actual 2>&1
464 check
"$expected" "$actual"
466 # Write the expected output.
467 cat > $expected <<EOF
468 msg part type/subtype size description
469 13 multipart/mixed 1038
470 1 multipart/alternative 518
471 2 multipart/alternative 326
474 # check it -- ask for audio/basic in part 1, should get nothing
475 run_prog mhlist
-part 1 -type audio
/basic
$msgnum > $actual 2>&1
476 check
"$expected" "$actual"
478 # Write the expected output.
479 cat > $expected <<EOF
480 msg part type/subtype size description
481 13 multipart/mixed 1038
482 1 multipart/alternative 518
486 2 multipart/alternative 326
492 # check it -- bump plain and wav to the top of their parts
493 run_prog mhlist
-prefer text
/plain
-prefer audio
/wav
$msgnum > $actual 2>&1
494 check
"$expected" "$actual"
496 # Write the expected output.
497 cat > $expected <<EOF
498 msg part type/subtype size description
499 13 multipart/mixed 1038
500 1 multipart/alternative 518
504 2 multipart/alternative 326
510 # check it -- bump plain and enriched to the top. add a bogus type as well.
511 run_prog mhlist
-prefer foo
/bar
-prefer text
/plain
-prefer text
/enriched
$msgnum > $actual 2>&1
512 check
"$expected" "$actual"