From 5cc5dbfe040a1c852f95b28da3f1788df9e1e94f Mon Sep 17 00:00:00 2001 From: David Levine Date: Sat, 3 Mar 2012 12:23:58 -0600 Subject: [PATCH] Added test-mhlist. --- Makefile.am | 2 +- test/mhlist/test-mhlist | 175 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+), 1 deletion(-) create mode 100755 test/mhlist/test-mhlist diff --git a/Makefile.am b/Makefile.am index 2b2cc63..faa7485 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,7 +49,7 @@ TESTS = test/bad-input/test-header test/comp/test-comp-format \ test/forw/test-forw-format \ test/inc/test-deb359167 test/inc/test-eom-align \ test/manpages/test-manpages test/mhbuild/test-forw \ - test/mhpath/test-mhpath \ + test/mhlist/test-mhlist test/mhpath/test-mhpath \ test/mhshow/test-cte-binary test/mhshow/test-qp \ test/mhshow/test-subpart test/new/test-basic \ test/pick/test-pick test/pick/test-stderr \ diff --git a/test/mhlist/test-mhlist b/test/mhlist/test-mhlist new file mode 100755 index 0000000..f61a136 --- /dev/null +++ b/test/mhlist/test-mhlist @@ -0,0 +1,175 @@ +#!/bin/sh +###################################################### +# +# Test mhlist +# +###################################################### + +set -e + +if test -z "${MH_OBJ_DIR}"; then + srcdir=`dirname $0`/../.. + MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR +fi + +. "$MH_OBJ_DIR/test/common.sh" + +setup_test + +expected=$MH_TEST_DIR/$$.expected +actual=$MH_TEST_DIR/$$.actual + + +# check with no options and no current message +run_test 'mhlist' 'mhlist: no cur message' + +# check with no options and current message +folder +inbox 5 > /dev/null +cat > $expected < $actual 2>&1 +check $expected $actual 'keep first' + +# check -noheaders +run_test 'mhlist 5 -noheaders' ' 5 text/plain 25' + +# check -headers +mhlist -noheaders -headers > $actual 2>&1 +check $expected $actual 'keep first' + +# check with folder and current message +mhlist +inbox > $actual 2>&1 +check $expected $actual 'keep first' + +# check with specified message +mhlist 5 > $actual 2>&1 +check $expected $actual 'keep first' + +# check -file +mhlist -file "$MH_TEST_DIR/Mail/inbox/5" > $actual 2>&1 +check $expected $actual + +# check -file - +cat > $expected < $actual 2>&1 +check $expected $actual + +# check message number greater than highest +run_test 'mhlist 11' "mhlist: message 11 doesn't exist" + +# check multiple messages +cat > $expected < $actual 2>&1 +check $expected $actual + +# Write message with a text/plain subpart. +msgfile=$(mhpath new) +cat > $msgfile < $MH_TEST_DIR/$$.tmp +mv -f $MH_TEST_DIR/$$.tmp $msgfile +run_test 'mhlist last -part 2 -noheader -check' \ +' 11 multipart/mixed 900 + 1 multipart/related 164 + 2 text/plain 36 +mhlist: content integrity suspect (digest mismatch) -- continuing + (content text/plain in message 11, part 2)' + +# check -nocheck, the default +run_test 'mhlist last -part 2 -noheader -check -nocheck' \ +' 11 multipart/mixed 900 + 1 multipart/related 164 + 2 text/plain 36' + +exit $failed -- 1.7.10.4