]>
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
-
21 expected
=$MH_TEST_DIR/$$.expected
22 actual
=$MH_TEST_DIR/$$.actual
25 start_test
'with no options and no current message'
26 run_test
'mhlist' 'mhlist: no cur message'
28 start_test
'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'
37 start_test
'-noheaders'
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 start_test
'with folder and current message'
45 run_prog mhlist
+inbox
> $actual 2>&1
46 check
$expected $actual 'keep first'
48 start_test
'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 start_test
'message with no blank line separating the headers from the body.'
65 # Shouldn't make a difference to the size of the body part.
66 # Bug meant no-blank-line case was one bigger by including the `\n'
67 # ending the last header.
68 f
=$MH_TEST_DIR/$$.blank
75 sed '/^$/d' $f-yes >$f-no
76 run_prog mhlist
-file $f-yes >$actual-yes
77 run_prog mhlist
-file $f-no >$actual-no
78 check
$actual-yes $actual-no
81 start_test
'message number greater than highest'
82 run_test
'mhlist 11' "mhlist: message 11 doesn't exist"
84 start_test
'multiple messages'
86 msg part type/subtype size description
90 run_prog mhlist
2 8 > $actual 2>&1
91 check
$expected $actual
93 # Write message with a text/plain subpart.
96 To: recipient@example.com
97 From: sender@example.com
100 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
102 ------- =_aaaaaaaaaa0
103 Content-Type: multipart/related;
104 type="multipart/alternative";
105 boundary="subpart__1.1"
108 Content-Type: text/plain; charset="iso-8859-1"
109 Content-Disposition: attachment; filename="test1"
111 This is the first text/plain part, in a subpart.
115 ------- =_aaaaaaaaaa0
116 Content-Type: text/plain; charset="iso-8859-1"
117 Content-Disposition: attachment; filename="test2"
118 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
119 Content-Transfer-Encoding: quoted-printable
121 This is the second text/plain part.
123 ------- =_aaaaaaaaaa0
124 Content-Type: text/plain; charset="iso-8859-1"; name="test3"
125 Content-Disposition: attachment; filename="test3"
127 This is the third text/plain part.
129 ------- =_aaaaaaaaaa0
130 Content-Type: text/plain; charset="iso-8859-1"
131 Content-Disposition: attachment; filename="test4"
132 Content-Transfer-Encoding: base64
134 VGhpcyBpcyB0aGUgZm91cnRoIHRleHQvcGxhaW4gcGFydC4K
136 ------- =_aaaaaaaaaa0--
140 run_test
'mhlist last -part 3 -noheader' \
141 ' 11 multipart/mixed 936
142 1 multipart/related 180
145 start_test
'-part of a subpart'
146 run_test
'mhlist last -part 1.1 -noheader' \
147 ' 11 multipart/mixed 936
148 1 multipart/related 180
152 run_test
'mhlist last -type text/plain -noheader' \
153 ' 11 multipart/mixed 936
154 1 multipart/related 180
160 start_test
'-norealsize'
161 run_test
'mhlist last -part 4 -noheader -norealsize' \
162 ' 11 multipart/mixed 936
163 1 multipart/related 180
166 start_test
'-realsize, the default'
167 run_test
'mhlist last -part 4 -noheader -norealsize -realsize' \
168 ' 11 multipart/mixed 936
169 1 multipart/related 180
173 run_test
'mhlist last -part 2 -noheader -check' \
174 ' 11 multipart/mixed 936
175 1 multipart/related 180
178 start_test
'-check with bad MD5 checksum'
179 sed 's/\(Content-MD5: \)kq+Hnc/\1BADBAD/' $msgfile > $MH_TEST_DIR/$$.tmp
180 mv -f $MH_TEST_DIR/$$.tmp
$msgfile
181 run_test
'mhlist last -part 2 -noheader -check' \
182 ' 11 multipart/mixed 936
183 1 multipart/related 180
185 mhlist: content integrity suspect (digest mismatch) -- continuing
186 (content text/plain in message 11, part 2)'
188 start_test
'-nocheck, the default'
189 run_test
'mhlist last -part 2 -noheader -check -nocheck' \
190 ' 11 multipart/mixed 936
191 1 multipart/related 180
195 # Set the cur sequence to 1 to test default behavior of changecur after
199 mark
1 -sequence cur
-add -zero
201 start_test
'-verbose'
202 run_test
'mhlist 11 -verbose -noheader' \
203 ' 11 multipart/mixed 936
204 boundary="----- =_aaaaaaaaaa0"
205 1 multipart/related 180
206 type="multipart/alternative"
207 boundary="subpart__1.1"
216 charset="iso-8859-1"'
219 start_test
'default changecur behavior'
222 run_test
'mark -sequence cur -list' 'cur: 11'
225 # Now test -nochangecur
228 mhlist
-nochangecur 1 >/dev
/null
230 run_test
'mark -sequence cur -list' 'cur: 11'
232 start_test
'MIME parser and m_getfld'
233 cat > $expected <<EOF
234 msg part type/subtype size description
235 12 multipart/related 204
236 1 multipart/alternative 74
242 msgnum
=`basename $msgfile`
244 To: 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,
339 recipient@example.com, recipient@example.com, recipient@example.com,
340 recipient@example.com, recipient@example.com, recipient@example.com,
341 recipient@example.com, recipient@example.com, recipient@example.com,
342 recipient@example.com, recipient@example.com, recipient@example.com,
343 recipient@example.com, recipient@example.com, recipient@example.com,
344 recipient@example.com, recipient@example.com, recipient@example.com,
345 recipient@example.com, recipient@example.com, recipient@example.com,
346 recipient@example.com, recipient@example.com, recipient@example.com,
347 recipient@example.com, recipient@example.com, recipient@example.com,
348 recipient@example.com, recipient@example.com, recipient@example.com,
349 recipient@example.com, recipient@example.com, recipient@example.com,
350 recipient@example.com, recipient@example.com, recipient@example.com,
351 recipient@example.com, recipient@example.com, recipient@example.com,
352 recipient@example.com, recipient@example.com, recipient@example.com,
353 recipient@example.com, recipient@example.com, recipient@example.com,
354 recipient@example.com, recipient@example.com, recipient@example.com,
355 recipient@example.com, recipient@example.com, recipient@example.com,
357 From: sender@example.com
358 Subject: very long header
359 Date: Wed, 4 Dec 2013 21:12:00 -0500
361 Content-Type: multipart/related; boundary="1"
364 Content-Type: multipart/alternative; boundary="2"
367 Content-Type: text/plain; charset="us-ascii"
375 Content-Type: text/plain; charset="us-ascii"
383 run_prog mhlist last
> $actual 2>&1
384 check
$expected $actual
386 ## now check mhlist output
389 msgnum
=`basename $msgfile`
391 To: example@example.org
392 From: someone <someone@example.com>
394 Date: Thu, 29 Jan 2015 18:12:21 +0000 (GMT)
395 Content-Type: multipart/mixed; boundary="BoundaryMixed"
398 Content-type: multipart/alternative;
399 boundary="BoundaryAlternative1"
401 --BoundaryAlternative1
402 Content-type: text/enriched; CHARSET=US-ASCII
403 Content-transfer-encoding: 7bit
405 This is supposedly enriched.
407 --BoundaryAlternative1
408 Content-type: text/plain; charset=ISO-8859-1; format=flowed
409 Content-transfer-encoding: 8bit
411 This is the body text/plain part.
413 --BoundaryAlternative1
414 Content-type: text/html; CHARSET=US-ASCII
415 Content-transfer-encoding: 7bit
417 <html><body><div><span style="line-height: 1.5;">
418 This is the text/html body part.
419 </span></div></body></html>
421 --BoundaryAlternative1--
424 Content-type: multipart/alternative;
425 boundary="BoundaryAlternative2"
427 --BoundaryAlternative2
428 Content-type: audio/wav
429 Content-transfer-encoding: 8bit
433 --BoundaryAlternative2
434 Content-type: audio/mp3
435 Content-transfer-encoding: 8bit
439 --BoundaryAlternative2
440 Content-type: audio/basic
441 Content-transfer-encoding: 8bit
445 --BoundaryAlternative2--
450 # Write the expected output.
451 cat > $expected <<EOF
452 msg part type/subtype size description
453 13 multipart/mixed 1038
454 1 multipart/alternative 518
458 2 multipart/alternative 326
464 start_test
'vanilla output'
465 run_prog mhlist
$msgnum > $actual 2>&1
466 check
"$expected" "$actual"
468 # Write the expected output.
469 cat > $expected <<EOF
470 msg part type/subtype size description
471 13 multipart/mixed 1038
472 1 multipart/alternative 518
476 2 multipart/alternative 326
479 start_test
'just part 1'
480 run_prog mhlist
-part 1 $msgnum > $actual 2>&1
481 check
"$expected" "$actual"
483 # Write the expected output.
484 cat > $expected <<EOF
485 msg part type/subtype size description
486 13 multipart/mixed 1038
487 1 multipart/alternative 518
488 2 multipart/alternative 326
491 start_test
'ask for audio/basic in part 1, should get nothing'
492 run_prog mhlist
-part 1 -type audio
/basic
$msgnum > $actual 2>&1
493 check
"$expected" "$actual"
495 # Write the expected output.
496 cat > $expected <<EOF
497 msg part type/subtype size description
498 13 multipart/mixed 1038
499 1 multipart/alternative 518
503 2 multipart/alternative 326
509 start_test
'bump plain and wav to the top of their parts'
510 run_prog mhlist
-prefer text
/plain
-prefer audio
/wav
$msgnum > $actual 2>&1
511 check
"$expected" "$actual"
513 # Write the expected output.
514 cat > $expected <<EOF
515 msg part type/subtype size description
516 13 multipart/mixed 1038
517 1 multipart/alternative 518
521 2 multipart/alternative 326
527 start_test
'bump plain and enriched to the top. add a bogus type as well.'
528 run_prog mhlist
-prefer foo
/bar
-prefer text
/plain
-prefer text
/enriched
$msgnum > $actual 2>&1
529 check
"$expected" "$actual"