Commit 7cff1869 7cff1869ad37104b52bd4e0b36c95291c7d12151 by Sergey Poznyakoff

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.
1 parent e362f5f9
......@@ -131,12 +131,13 @@ static msg_part_t msg_part_parse (char *str);
static int msg_part_level (msg_part_t p);
static size_t msg_part_subpart (msg_part_t p, int level);
enum mhn_mode {
enum mhn_mode
{
mode_compose,
mode_list,
mode_show,
mode_store,
};
};
static enum mhn_mode mode = mode_compose;
......@@ -781,7 +782,7 @@ mhn_show_command (mu_message_t msg, msg_part_t part, int *flags,
}
else if (mu_c_strcasecmp (typestr, "application/octet-stream") == 0 &&
check_type (typeargs, "tar") == 0)
/* Use temporary file to get tar a chance to select appropriate
/* Use temporary file to give tar a chance to select appropriate
decompressor, if the archive is compressed. */
str = "tar tvf '%F'";
else
......@@ -1482,9 +1483,10 @@ sigint (int sig)
static int
mhn_pause ()
{
int c;
char c;
int rc = 0;
RETSIGTYPE (*saved_sig) (int) = signal (SIGINT, sigint);
printf (_("Press <return> to show content..."));
fflush (stdout);
do
......
......@@ -320,5 +320,96 @@ And the mome raths outgrabe.
])
MH_CHECK([mhn-show type=tar],[mhn13 mhn-show-type=tar],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox])
mhn -show 2 | sed /^X-IMAPbase/d
],
[0],
[Date: Mon, 29 Nov 2010 14:04:19 +0200
To: <gray@example.net>
From: Sergey Poznyakoff <gray@example.net>
Subject: Verses (type=tar)
MIME-Version: 1.0
X-Envelope-Date: Mon Nov 29 14:04:19 2010
X-Envelope-Sender: gray@example.net
part 1 text/plain 15
Initial text.
-rw-r--r-- gray/staff 1418 2010-11-29 13:58 Father_William
-rw-r--r-- gray/staff 937 2010-11-29 13:58 Jabberwocky
])
# FIXME: What about exit code?
# FIXME: See comment about the error message, near mhn.c:792
MH_CHECK([mhn-show unsupported type],[mhn14 mhn-show-unsupported-type],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox])
mhn -show 1 | sed /^X-IMAPbase/d
],
[0],
[Date: Mon, 29 Nov 2010 14:00:03 +0200
To: <gray@example.net>
From: Sergey Poznyakoff <gray@example.net>
Subject: Verses (x-tar)
MIME-Version: 1.0
X-Envelope-Date: Mon Nov 29 14:00:03 2010
X-Envelope-Sender: gray@example.net
part 1 text/plain 15
Initial text.
],
[mhn: don't know how to display content (content application/x-tar in message 1, part 2)
])
MH_CHECK([mhn-show- variable (with subtype)],[mhn15 mhn-show-with-subtype],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox])
echo "mhn-show-application/x-tar: %ltar tvf '%F'" >> $MH
mhn -show 1 | sed '/^X-IMAPbase/d;s/ *$//'
],
[0],
[Date: Mon, 29 Nov 2010 14:00:03 +0200
To: <gray@example.net>
From: Sergey Poznyakoff <gray@example.net>
Subject: Verses (x-tar)
MIME-Version: 1.0
X-Envelope-Date: Mon Nov 29 14:00:03 2010
X-Envelope-Sender: gray@example.net
part 1 text/plain 15
Initial text.
part 2 application/x-tar 13835
-rw-r--r-- gray/staff 1418 2010-11-29 13:58 Father_William
-rw-r--r-- gray/staff 937 2010-11-29 13:58 Jabberwocky
])
MH_CHECK([mhn-show- variable (with subtype)],[mhn16 mhn-show-without-subtype],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox])
echo "mhn-show-application: %ltar tvf '%F'" >> $MH
mhn -show 1 | sed '/^X-IMAPbase/d;s/ *$//'
],
[0],
[Date: Mon, 29 Nov 2010 14:00:03 +0200
To: <gray@example.net>
From: Sergey Poznyakoff <gray@example.net>
Subject: Verses (x-tar)
MIME-Version: 1.0
X-Envelope-Date: Mon Nov 29 14:00:03 2010
X-Envelope-Sender: gray@example.net
part 1 text/plain 15
Initial text.
part 2 application/x-tar 13835
-rw-r--r-- gray/staff 1418 2010-11-29 13:58 Father_William
-rw-r--r-- gray/staff 937 2010-11-29 13:58 Jabberwocky
])
m4_popdef[MH_KEYWORDS])
# End of mhn.at
......
......@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 lib etc spool folder maildir mh
EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 lib etc spool folder maildir mh mime
DISTCLEANFILES = atconfig $(check_SCRIPTS)
MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
......