mh: improve testsuite.
* mh/mhn.c (mhn_pause): Fix type of the local buffer variable. * mh/tests/mhn.at: Add more -show tests. * testsuite/mh/mime/1: New file. * testsuite/mh/mime/2: New file. * testsuite/Makefile.am (EXTRA_DIST): Add mime.
Showing
5 changed files
with
98 additions
and
5 deletions
... | @@ -131,12 +131,13 @@ static msg_part_t msg_part_parse (char *str); | ... | @@ -131,12 +131,13 @@ static msg_part_t msg_part_parse (char *str); |
131 | static int msg_part_level (msg_part_t p); | 131 | static int msg_part_level (msg_part_t p); |
132 | static size_t msg_part_subpart (msg_part_t p, int level); | 132 | static size_t msg_part_subpart (msg_part_t p, int level); |
133 | 133 | ||
134 | enum mhn_mode { | 134 | enum mhn_mode |
135 | { | ||
135 | mode_compose, | 136 | mode_compose, |
136 | mode_list, | 137 | mode_list, |
137 | mode_show, | 138 | mode_show, |
138 | mode_store, | 139 | mode_store, |
139 | }; | 140 | }; |
140 | 141 | ||
141 | static enum mhn_mode mode = mode_compose; | 142 | static enum mhn_mode mode = mode_compose; |
142 | 143 | ||
... | @@ -781,7 +782,7 @@ mhn_show_command (mu_message_t msg, msg_part_t part, int *flags, | ... | @@ -781,7 +782,7 @@ mhn_show_command (mu_message_t msg, msg_part_t part, int *flags, |
781 | } | 782 | } |
782 | else if (mu_c_strcasecmp (typestr, "application/octet-stream") == 0 && | 783 | else if (mu_c_strcasecmp (typestr, "application/octet-stream") == 0 && |
783 | check_type (typeargs, "tar") == 0) | 784 | check_type (typeargs, "tar") == 0) |
784 | /* Use temporary file to get tar a chance to select appropriate | 785 | /* Use temporary file to give tar a chance to select appropriate |
785 | decompressor, if the archive is compressed. */ | 786 | decompressor, if the archive is compressed. */ |
786 | str = "tar tvf '%F'"; | 787 | str = "tar tvf '%F'"; |
787 | else | 788 | else |
... | @@ -1482,9 +1483,10 @@ sigint (int sig) | ... | @@ -1482,9 +1483,10 @@ sigint (int sig) |
1482 | static int | 1483 | static int |
1483 | mhn_pause () | 1484 | mhn_pause () |
1484 | { | 1485 | { |
1485 | int c; | 1486 | char c; |
1486 | int rc = 0; | 1487 | int rc = 0; |
1487 | RETSIGTYPE (*saved_sig) (int) = signal (SIGINT, sigint); | 1488 | RETSIGTYPE (*saved_sig) (int) = signal (SIGINT, sigint); |
1489 | |||
1488 | printf (_("Press <return> to show content...")); | 1490 | printf (_("Press <return> to show content...")); |
1489 | fflush (stdout); | 1491 | fflush (stdout); |
1490 | do | 1492 | do | ... | ... |
... | @@ -320,5 +320,96 @@ And the mome raths outgrabe. | ... | @@ -320,5 +320,96 @@ And the mome raths outgrabe. |
320 | 320 | ||
321 | ]) | 321 | ]) |
322 | 322 | ||
323 | MH_CHECK([mhn-show type=tar],[mhn13 mhn-show-type=tar],[ | ||
324 | MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox]) | ||
325 | mhn -show 2 | sed /^X-IMAPbase/d | ||
326 | ], | ||
327 | [0], | ||
328 | [Date: Mon, 29 Nov 2010 14:04:19 +0200 | ||
329 | To: <gray@example.net> | ||
330 | From: Sergey Poznyakoff <gray@example.net> | ||
331 | Subject: Verses (type=tar) | ||
332 | |||
333 | MIME-Version: 1.0 | ||
334 | X-Envelope-Date: Mon Nov 29 14:04:19 2010 | ||
335 | X-Envelope-Sender: gray@example.net | ||
336 | |||
337 | part 1 text/plain 15 | ||
338 | Initial text. | ||
339 | |||
340 | -rw-r--r-- gray/staff 1418 2010-11-29 13:58 Father_William | ||
341 | -rw-r--r-- gray/staff 937 2010-11-29 13:58 Jabberwocky | ||
342 | ]) | ||
343 | |||
344 | # FIXME: What about exit code? | ||
345 | # FIXME: See comment about the error message, near mhn.c:792 | ||
346 | MH_CHECK([mhn-show unsupported type],[mhn14 mhn-show-unsupported-type],[ | ||
347 | MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox]) | ||
348 | mhn -show 1 | sed /^X-IMAPbase/d | ||
349 | ], | ||
350 | [0], | ||
351 | [Date: Mon, 29 Nov 2010 14:00:03 +0200 | ||
352 | To: <gray@example.net> | ||
353 | From: Sergey Poznyakoff <gray@example.net> | ||
354 | Subject: Verses (x-tar) | ||
355 | |||
356 | MIME-Version: 1.0 | ||
357 | X-Envelope-Date: Mon Nov 29 14:00:03 2010 | ||
358 | X-Envelope-Sender: gray@example.net | ||
359 | |||
360 | part 1 text/plain 15 | ||
361 | Initial text. | ||
362 | |||
363 | ], | ||
364 | [mhn: don't know how to display content (content application/x-tar in message 1, part 2) | ||
365 | ]) | ||
366 | |||
367 | MH_CHECK([mhn-show- variable (with subtype)],[mhn15 mhn-show-with-subtype],[ | ||
368 | MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox]) | ||
369 | echo "mhn-show-application/x-tar: %ltar tvf '%F'" >> $MH | ||
370 | mhn -show 1 | sed '/^X-IMAPbase/d;s/ *$//' | ||
371 | ], | ||
372 | [0], | ||
373 | [Date: Mon, 29 Nov 2010 14:00:03 +0200 | ||
374 | To: <gray@example.net> | ||
375 | From: Sergey Poznyakoff <gray@example.net> | ||
376 | Subject: Verses (x-tar) | ||
377 | |||
378 | MIME-Version: 1.0 | ||
379 | X-Envelope-Date: Mon Nov 29 14:00:03 2010 | ||
380 | X-Envelope-Sender: gray@example.net | ||
381 | |||
382 | part 1 text/plain 15 | ||
383 | Initial text. | ||
384 | |||
385 | part 2 application/x-tar 13835 | ||
386 | -rw-r--r-- gray/staff 1418 2010-11-29 13:58 Father_William | ||
387 | -rw-r--r-- gray/staff 937 2010-11-29 13:58 Jabberwocky | ||
388 | ]) | ||
389 | |||
390 | MH_CHECK([mhn-show- variable (with subtype)],[mhn16 mhn-show-without-subtype],[ | ||
391 | MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox]) | ||
392 | echo "mhn-show-application: %ltar tvf '%F'" >> $MH | ||
393 | mhn -show 1 | sed '/^X-IMAPbase/d;s/ *$//' | ||
394 | ], | ||
395 | [0], | ||
396 | [Date: Mon, 29 Nov 2010 14:00:03 +0200 | ||
397 | To: <gray@example.net> | ||
398 | From: Sergey Poznyakoff <gray@example.net> | ||
399 | Subject: Verses (x-tar) | ||
400 | |||
401 | MIME-Version: 1.0 | ||
402 | X-Envelope-Date: Mon Nov 29 14:00:03 2010 | ||
403 | X-Envelope-Sender: gray@example.net | ||
404 | |||
405 | part 1 text/plain 15 | ||
406 | Initial text. | ||
407 | |||
408 | part 2 application/x-tar 13835 | ||
409 | -rw-r--r-- gray/staff 1418 2010-11-29 13:58 Father_William | ||
410 | -rw-r--r-- gray/staff 937 2010-11-29 13:58 Jabberwocky | ||
411 | ]) | ||
412 | |||
413 | |||
323 | m4_popdef[MH_KEYWORDS]) | 414 | m4_popdef[MH_KEYWORDS]) |
324 | # End of mhn.at | 415 | # End of mhn.at | ... | ... |
... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
14 | # You should have received a copy of the GNU General Public License | 14 | # You should have received a copy of the GNU General Public License |
15 | # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | ||
17 | EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 lib etc spool folder maildir mh | 17 | EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 lib etc spool folder maildir mh mime |
18 | DISTCLEANFILES = atconfig $(check_SCRIPTS) | 18 | DISTCLEANFILES = atconfig $(check_SCRIPTS) |
19 | MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) | 19 | MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) |
20 | 20 | ... | ... |
testsuite/mh/mime/1
0 → 100644
This diff is collapsed.
Click to expand it.
testsuite/mh/mime/2
0 → 100644
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment