From 82325c1114254a76b8285bb710b2f651674331c7 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Fri, 23 Oct 2015 15:30:10 +0200 Subject: [PATCH] Rework in the test framework; updated and new tests Many tests were ported from nmh. Two tests fail at the moment: - tests/ali/test-ali: needs porting the bugfix from nmh - tests/prompter/test-prompter: needs further investigation --- test/common.sh | 75 +++++- test/runalltests | 2 + test/runtest | 6 +- test/tests/ali/test-ali | 128 ++++++++++ test/tests/anno/test-anno | 230 ++++++++++++++++++ test/tests/bad-input/test-header | 93 ++++++-- test/tests/burst/test-burst | 158 ++++++++++++ test/tests/burst/test-burst-mime | 145 +++++++++++ test/tests/folder/test-create | 6 +- test/tests/folder/test-recurse | 24 ++ test/tests/folder/test-sortm | 409 +++++++++++++++++++++++++++++++ test/tests/folder/test-total | 8 +- test/tests/folder/x-test-packf | 70 ++++++ test/tests/inc/test-eom-align | 2 +- test/tests/mhbuild/test-forw | 40 +--- test/tests/mhbuild/test-header-encode | 67 +++--- test/tests/mhbuild/test-linebreak | 75 ++++++ test/tests/mhl/test-mhl-flags | 55 +++++ test/tests/mhlist/test-ext-params | 183 ++++++++++++++ test/tests/mhlist/test-mhlist | 425 +++++++++++++++++++++++++++++++++ test/tests/mhparam/test-mhparam | 186 +++++++++++++++ test/tests/prompter/test-prompter | 166 +++++++++++++ test/tests/rcv/test-rcvdist | 108 +++++++++ test/tests/rcv/test-rcvpack | 52 ++++ test/tests/rcv/test-rcvstore | 188 +++++++++++++++ test/tests/scan/test-scan | 101 +++++++- test/tests/scan/test-scan-multibyte | 41 ++++ test/tests/show/test-multibytes | 46 ++++ 28 files changed, 2980 insertions(+), 109 deletions(-) create mode 100755 test/tests/ali/test-ali create mode 100755 test/tests/anno/test-anno create mode 100755 test/tests/burst/test-burst create mode 100755 test/tests/burst/test-burst-mime create mode 100755 test/tests/folder/test-recurse create mode 100755 test/tests/folder/test-sortm create mode 100755 test/tests/folder/x-test-packf create mode 100644 test/tests/mhbuild/test-linebreak create mode 100755 test/tests/mhl/test-mhl-flags create mode 100755 test/tests/mhlist/test-ext-params create mode 100755 test/tests/mhlist/test-mhlist create mode 100755 test/tests/mhparam/test-mhparam create mode 100755 test/tests/prompter/test-prompter create mode 100755 test/tests/rcv/test-rcvdist create mode 100755 test/tests/rcv/test-rcvpack create mode 100755 test/tests/rcv/test-rcvstore create mode 100644 test/tests/scan/test-scan-multibyte create mode 100644 test/tests/show/test-multibytes diff --git a/test/common.sh b/test/common.sh index 0fd3afb..d195a7c 100644 --- a/test/common.sh +++ b/test/common.sh @@ -1,11 +1,19 @@ # Common helper routines for test shell scripts # -- intended to be sourced by them +tmpfile="`mktemp`" +trap ' + rm -f "$tmpfile" + exit "$failed" +' 0 1 2 15 +failed=0 + + test_skip() { - WHY="$1" - echo "Test $0 SKIP ($WHY)" - exit 120 + echo "$0: $1" + failed=120 + exit } # portable implementation of 'which' utility @@ -34,19 +42,29 @@ require_prog() fi } +require_locale() +{ + for locale in "$@"; do + if locale -a | grep -i "$locale" >/dev/null; then + return + fi + done + test_skip "no suitable locale available" +} + # Some stuff for doing silly progress indicators progress_update() { test -t 1 || return 0 # supress progress meter if non-interactive - THIS="$1" - FIRST="$2" - LAST="$3" - RANGE="$(expr $LAST - $FIRST ||:)" - PROG="$(expr $THIS - $FIRST ||:)" + this="$1" + first="$2" + last="$3" + range="$(expr $last - $first ||:)" + prog="$(expr $this - $first ||:)" # this automatically rounds to nearest integer - PERC="$(expr 100 \* $PROG / $RANGE ||:)" + perc="$(expr 100 \* $prog / $range ||:)" # note \r so next update will overwrite - printf "%3d%%\r" $PERC + printf "%3d%%\r" $perc } progress_done() @@ -54,3 +72,40 @@ progress_done() test -t 1 || return 0 # supress progress meter if non-interactive printf "100%%\n" } + + + +#### Filter that squeezes blank lines, partially emulating GNU cat -s, +#### but sufficient for our purpose. +#### From http://www-rohan.sdsu.edu/doc/sed.html, compiled by Eric Pement. +squeeze_lines() +{ + sed '/^$/N;/\n$/D' +} + +#### Filter that converts non-breakable space U+00A0 to an ASCII space. +prepare_space() +{ + sed 's/'"`printf '\\302\\240'`"'/ /g' +} + + +# first argument: command line to run +# second argument: "normspace" to normalize the whitespace +# stdin: expected output +runandcheck() +{ + if [ "$2" = "normspace" ]; then + eval "$1" 2>&1 | prepare_space >"$tmpfile" + diff="`prepare_space | diff -ub - "$tmpfile" || :`" + else + eval "$1" >"$tmpfile" 2>&1 + diff="`diff -u - "$tmpfile"`" + fi + + if [ "$diff" ]; then + echo "$0: $1 failed" + echo "$diff" + failed=`expr "${failed:-0}" + 1` + fi +} diff --git a/test/runalltests b/test/runalltests index 279ced5..a4a7269 100755 --- a/test/runalltests +++ b/test/runalltests @@ -33,3 +33,5 @@ BEGIN { printf("%-12s %4d\n", "Total", sum); } ' + +exit `test "$failed" -eq 0` diff --git a/test/runtest b/test/runtest index 8867661..498db05 100755 --- a/test/runtest +++ b/test/runtest @@ -56,15 +56,15 @@ return_value=$? set -e if [ $return_value -eq 0 ] ; then - printf "Test %s:\tPASS\n" "$1" + printf "Test %-60s\tPASS\n" "$1" exit 0 elif [ $return_value -eq 120 ]; then # indicates test was skipped (eg needed program not found) # test itself should have printed a message about this, # so print nothing here. - : + printf "Test %-60s\tSKIP\n" "$1" exit 2 else - printf "Test %s:\tFAIL\n" "$1" + printf "Test %-60s\tFAIL\n" "$1" exit 1 fi diff --git a/test/tests/ali/test-ali b/test/tests/ali/test-ali new file mode 100755 index 0000000..f37a1ac --- /dev/null +++ b/test/tests/ali/test-ali @@ -0,0 +1,128 @@ +#!/bin/sh +###################################################### +# +# Test ali +# +###################################################### + +. "$MH_TEST_COMMON" + +expected=$MH_TEST_DIR/$$.expected +expected_err=$MH_TEST_DIR/$$.expected_err +actual=$MH_TEST_DIR/$$.actual +actual_err=$MH_TEST_DIR/$$.actual_err + + +runandcheck "ali -help" <&2 + failed=`expr "${failed:-0}" + 1`;; +esac + + +# check with no arguments and no AliasFile profile component +runandcheck 'ali' <"${MH_TEST_DIR}/Mail/aliases" <"${MH_TEST_DIR}/Mail/aliases" <"${MH_TEST_DIR}/Mail/aliases" <&2 + failed=`expr "${failed:-0}" + 1`;; +esac + + +# check unknown switch +runandcheck "anno -nonexistent ||:" <"`mhpath b`" +runandcheck "cat `mhpath l`" <"`mhpath b`" +runandcheck "cat `mhpath l`" <"`mhpath b`" +runandcheck "cat `mhpath l`" </dev/null + +runandcheck "anno 11 -component Nmh-test" <"`mhpath b`" +runandcheck "cat `mhpath l`" <"`mhpath b`" +runandcheck "cat `mhpath l`" <"`mhpath b`" +runandcheck "cat `mhpath l`" < $msgfile < $expected < $actual 2>&1 -check +! # check show -cat > $expected <"$msgfile" +runandcheck "scan l" <"$msgfile" < $actual 2>&1 -check +runandcheck "scan l" </dev/null; then +# : +# else +# echo "$0: did not receive expected error message \"$1\"" +# failed=`expr ${failed:-0} + 1` +# fi +# } +# verify_string_in_file 'scan: field name "ThisHeaderFieldNameIsWa' "$actual_err" +# verify_string_in_file 'exceeds 997' "$actual_err" +# verify_string_in_file '??Format error (message 13) in component 2' "$actual_err" +# rm -f "$actual_err" + + + + +# check m_getfld() handling of long header field name without a colon + +msgfile="$MH_TEST_DIR/Mail/inbox/14" +cat >"$msgfile" < "$msgpath" < +To: Test Recipient +Date: Friday, 29 Sep 2006 00:00:00 +Subject: Test digest + +------- Message one + +From: Mister Burster +To: Nobody 1 +Date: Thursday, 28 Sep 2006 00:01:00 +Subject: Message one + +This is message one + +------- Message two + +From: Mister Burster +To: Nobody 2 +Date: Thursday, 28 Sep 2006 00:02:00 +Subject: Message two + +This is message two +For real. + +------- + +End of all messages +EOF + +runandcheck "scan $msgnum" <"$msgpath" < +To: Test Recipient +Date: Friday, 29 Sep 2006 00:00:00 +Subject: Test digest + +This is a preamble +------- Message one + +From: Mister Burster +To: Nobody 1 +Date: Thursday, 28 Sep 2006 00:01:00 +Subject: Message one + +- -This is message one + +------- Message two +From: Mister Burster +To: Nobody 2 +Date: Thursday, 28 Sep 2006 00:02:00 +Subject: Message two + +This is message two +- For real. +------- Message three + + + +From: Mister Burster +To: Nobody 3 +Date: Thursday, 28 Sep 2006 00:03:00 +Subject: Message three + +Will this one work? + + +------ Message three +End of all messages +EOF + +runandcheck "burst $msgnum" </dev/null + +runandcheck "next" < +To: Nobody 1 +Date: Thursday, 28 Sep 2006 00:01:00 +Subject: Message one + +-This is message one +! + +runandcheck "next" < +To: Nobody 2 +Date: Thursday, 28 Sep 2006 00:02:00 +Subject: Message two + +This is message two +For real. +! + +runandcheck "next" < +To: Nobody 3 +Date: Thursday, 28 Sep 2006 00:03:00 +Subject: Message three + +Will this one work? + +! diff --git a/test/tests/burst/test-burst-mime b/test/tests/burst/test-burst-mime new file mode 100755 index 0000000..19ddaaa --- /dev/null +++ b/test/tests/burst/test-burst-mime @@ -0,0 +1,145 @@ +#!/bin/sh +# +# Tests to see if bursting MIME messages works correctly. +# + +. "$MH_TEST_COMMON" + +# +# Create a one-part test message that we can burst +# + +msgpath="`mhpath b`" +msgnum="${msgpath##*/}" + +cat >"$msgpath" < +To: Test Recipient +Date: Friday, 29 Sep 2006 00:00:00 +Subject: Test MIME digest +MIME-Version: 1.0 +Content-type: message/rfc822 + +From: Mister Burster +To: Nobody 1 +Date: Thursday, 28 Sep 2006 00:01:00 +Subject: Message one + +- - This line should not be unstuffed + +EOF + +runandcheck "burst $msgnum" < "$msgpath" < +To: Test Recipient +Date: Friday, 29 Sep 2006 00:00:00 +Subject: Test digest +MIME-Version: 1.0 +Content-Type: multipart/digest; boundary="----- =_aaaaaaaaaa0" + +This is a preamble + +------- =_aaaaaaaaaa0 + +Content-Type: message/rfc822 + +From: Mister Burster +To: Nobody 1 +Date: Thursday, 28 Sep 2006 00:01:00 +Subject: Message one + +- -This is message one + +------- =_aaaaaaaaaa0 + +From: Mister Burster +To: Nobody 2 +Date: Thursday, 28 Sep 2006 00:02:00 +Subject: Message two + +This is message two +- For real. + +------- =_aaaaaaaaaa0 + +From: Mister Burster +To: Nobody 3 +Date: Thursday, 28 Sep 2006 00:03:00 +Subject: Message three + +Will this one work? + +------- =_aaaaaaaaaa0-- + +EOF + +runandcheck "burst $msgnum" </dev/null + +runandcheck "next" < +To: Nobody 1 +Subject: Message one + +part text/plain 21 +-This is message one +! + +runandcheck "next" < +To: Nobody 2 +Subject: Message two + +part text/plain 30 +This is message two +For real. +! + +# +# The CR/LF that appears right before the boundary line is considered part +# of the boundary line, so this has the practical effect of "eating" a +# blank line if it's before the boundary (RFC 2046. 5.1.1). So make sure +# a double blank line results in only one blank line at the end of a message. +# + +runandcheck "next" < +To: Nobody 3 +Subject: Message three + +part text/plain 20 +Will this one work? +! diff --git a/test/tests/folder/test-create b/test/tests/folder/test-create index 5b74b23..1321a78 100644 --- a/test/tests/folder/test-create +++ b/test/tests/folder/test-create @@ -7,11 +7,11 @@ folder -create +testfolder > /dev/null if [ ! -d "$MH_TEST_DIR/Mail/testfolder" ]; then - exit 1 + exit 1 fi rmf +testfolder > /dev/null if [ -d "$MH_TEST_DIR/Mail/testfolder" ]; then - # Test failed - exit 1 + # Test failed + exit 1 fi diff --git a/test/tests/folder/test-recurse b/test/tests/folder/test-recurse new file mode 100755 index 0000000..abd2b2f --- /dev/null +++ b/test/tests/folder/test-recurse @@ -0,0 +1,24 @@ +#!/bin/sh +###################################################### +# +# Test of the -recuse option +# +###################################################### + +. "$MH_TEST_COMMON" + +runandcheck "folder -create +testfolder" <$MH_TEST_DIR/Mail/inbox/11 < +To: Some User +Date: Fri, 29 Sep 2006 00:00:01 +Alt-Date: Thu, 1 Sep 2005 00:00:00 +Subject: Re: common subject + +This is message number 11 +EOF + +cat >$MH_TEST_DIR/Mail/inbox/12 < +To: Some User +Date: Thu, 28 Sep 2006 23:59:59 +Alt-Date: Sat, 30 Sep 2006 00:00:00 +Subject: common subject + +This is message number 12 +EOF + + + +# check with no options + +runandcheck sortm </dev/null + +runandcheck "sortm +inbox" </dev/null + +runandcheck "sortm -verbose" </dev/null + +runandcheck "sortm -verbose -noverbose" </dev/null + +runandcheck "sortm f l" </dev/null + +runandcheck "sortm -textfield subject -limit 0" </dev/null + +runandcheck "sortm -textfield from -limit 0" <$MH_TEST_DIR/Mail/inbox/13 < +To: Some User +Date: Tue, 31 Oct 2006 23:59:59 +Subject: Re: common subject + +This is message number 13 +EOF + + + +# check -textfield with finite -limit that doesn't cover message 13 + +refile 2-7 +inbox +refile 1 +inbox +folder -pack l >/dev/null + +runandcheck "sortm -textfield subject -limit 10" </dev/null + +runandcheck "sortm -textfield subject -limit 60" </dev/null + +runandcheck "sortm -textfield subject -limit 60 -notextfield" < $MH_TEST_DIR/Mail/inbox/14 + +runandcheck "sortm" <msgbox" </dev/null +inc +inbox2 -file msgbox >/dev/null +rm -f msgbox + +for i in `pick +inbox`; do + diff -u "`mhpath +inbox $i`" "`mhpath +inbox2 $i`" +done + +runandcheck 'echo $i' <msgbox" </dev/null +rm -f msgbox +for i in `pick +inbox`; do + diff -u "`mhpath +inbox "$i"`" "`mhpath +inbox2 "$i"`" +done +runandcheck "echo $i" <msgbox" </dev/null +rm -f msgbox +for i in `pick +inbox2`; do + diff -u "`mhpath +inbox "$i"`" "`mhpath +inbox2 "$i"`" +done +runandcheck "echo $i" < $draft <"$draft" <][^>]*>/\1 /' $draft > $actual -} -draft=$MH_TEST_DIR/$$.draft -expected=$MH_TEST_DIR/$$.expected -actual=$MH_TEST_DIR/$$.actual +runandcheck 'mhbuild "$draft"' < $expected </" "$draft"' < $draft <"$draft" < To: Somebody Subject: This is ä test This is a test -EOF -} - -# Munge the Content-Id from the draft after mhbuild, so we have a reliable -# value to check. -mungedraft() { - sed 's/\(Content-ID:\) <[^>][^>]*>/\1 /' $draft > $actual -} +! -draft=$MH_TEST_DIR/$$.draft -expected=$MH_TEST_DIR/$$.expected -actual=$MH_TEST_DIR/$$.actual +runandcheck 'mhbuild "$draft"' < $expected </" "$draft"' < To: Somebody Subject: =?UTF-8?Q?This_is_=C3=A4_test?= @@ -46,10 +32,29 @@ Content-Type: text/plain; charset="us-ascii" Content-ID: This is a test -EOF -mkdraft -mhbuild $draft -mungedraft -check +! -exit $failed + +# To + From + +cat >"$draft" < +To: Gönül +Subject: Names with Umlauts + +This is a test +! + +runandcheck 'mhbuild "$draft"' </" "$draft"' < +To: =?UTF-8?Q?G=C3=B6n=C3=BCl?= +Subject: Names with Umlauts +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-ID: + +This is a test +! diff --git a/test/tests/mhbuild/test-linebreak b/test/tests/mhbuild/test-linebreak new file mode 100644 index 0000000..7b58f75 --- /dev/null +++ b/test/tests/mhbuild/test-linebreak @@ -0,0 +1,75 @@ +# test mhbuild linebreak for quoted-printable + +. "$MH_TEST_COMMON" + + +draft="$MH_TEST_DIR/mhbuild-$$.draft" + +cat >"$draft" </" "$draft"' < +Content-Transfer-Encoding: quoted-printable + +F=C3=BC=C3=9Fe <-- to ensure quoted-printable is used + + 1 2 3 4 5 6 7 +1234567890123456789012345678901234567890123456789012345678901234567890 +123456789012345678901234567890123456789012345678901234567890123456789012345 + +1234567890123456789012345678901234567890123456789012345678901234567890123. +12345678901234567890123456789012345678901234567890123456789012345678901234. +123456789012345678901234567890123456789012345678901234567890123456789012345= +=2E +123456789012345678901234567890123456789012345678901234567890123456789012345= +6. + +12345678901234567890123456789012345678901234567890123456789012345678901234.= +xx +123456789012345678901234567890123456789012345678901234567890123456789012345= +=2Exx +123456789012345678901234567890123456789012345678901234567890123456789012345= +6.xx + +12345678901234567890123456789012345678901234567890123456789012345678901234.= +=2Eyy +123456789012345678901234567890123456789012345678901234567890123456789012345= +=2E.yy +123456789012345678901234567890123456789012345678901234567890123456789012345= +6..yy +! diff --git a/test/tests/mhl/test-mhl-flags b/test/tests/mhl/test-mhl-flags new file mode 100755 index 0000000..7220e6c --- /dev/null +++ b/test/tests/mhl/test-mhl-flags @@ -0,0 +1,55 @@ +#!/bin/sh +# +# Test of various (well, start with one) function escapes. + +. "$MH_TEST_COMMON" + +test_skip "not implemented yet" + + +cat >`mhpath b` <"$MH_TEST_DIR/test.format" < There are two blank lines below. And there is a trailing space: +> And another trailing space: +> +> +! + + + +# check rtrim + +cat >"$MH_TEST_DIR/test.format" < There are two blank lines below. And there is a trailing space: +> And another trailing space: +> +> +! + + +rm -f "$MH_TEST_DIR/test.format" + diff --git a/test/tests/mhlist/test-ext-params b/test/tests/mhlist/test-ext-params new file mode 100755 index 0000000..7f3fec0 --- /dev/null +++ b/test/tests/mhlist/test-ext-params @@ -0,0 +1,183 @@ +#!/bin/sh +###################################################### +# +# Test mhlist with extended parameters (RFC 2231) +# +###################################################### + +. "$MH_TEST_COMMON" + +test_skip "not implemented yet" +exit + +require_locale en_US.utf-8 en_US.utf8 +LC_ALL=en_US.UTF-8 +export LC_ALL + + +# +# Make some more complicated message parameters. +# + +msgfile=`mhpath b` +cat > $msgfile < $msgfile < $msgfile < /dev/null +runandcheck mhlist < $msgfile < $msgfile < $msgfile < +Subject: mhlist test +Date: Thu, 29 Jan 2015 18:12:21 +0000 (GMT) +Content-Type: multipart/mixed; boundary="BoundaryMixed" + +--BoundaryMixed +Content-type: multipart/alternative; + boundary="BoundaryAlternative1" + +--BoundaryAlternative1 +Content-type: text/enriched; CHARSET=US-ASCII +Content-transfer-encoding: 7bit + +This is supposedly enriched. + +--BoundaryAlternative1 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 8bit + +This is the body text/plain part. + +--BoundaryAlternative1 +Content-type: text/html; CHARSET=US-ASCII +Content-transfer-encoding: 7bit + +
+This is the text/html body part. +
+ +--BoundaryAlternative1-- + +--BoundaryMixed +Content-type: multipart/alternative; + boundary="BoundaryAlternative2" + +--BoundaryAlternative2 +Content-type: audio/wav +Content-transfer-encoding: 8bit + +pretend wav audio + +--BoundaryAlternative2 +Content-type: audio/mp3 +Content-transfer-encoding: 8bit + +pretend mp3 audio + +--BoundaryAlternative2 +Content-type: audio/basic +Content-transfer-encoding: 8bit + +pretend basic audio + +--BoundaryAlternative2-- + +--BoundaryMixed-- +EOF + +# check it -- vanilla output +runandcheck "mhlist $msgnum" <&2 + failed=`expr ${failed:-0} + 1`;; +esac + +# check unknown option +runandcheck 'mhparam -nonexistent' </dev/null" </dev/null" <>"$MMHP" +runandcheck 'mhparam path AliasFile' </dev/null; echo \$?" </dev/null; echo \$?" </dev/null; echo \$?" <>"$MMHP" +runandcheck 'mhparam -nocomponent editor' <&2 + failed=`expr ${failed:-0} + 1`;; +esac + +# check unknown switch +runandcheck 'prompter -nonexistent' <$MH_TEST_DIR/prompter-file </dev/null + +runandcheck "cat $MH_TEST_DIR/prompter-file" <$MH_TEST_DIR/prompter-file </dev/null + +runandcheck "cat $MH_TEST_DIR/prompter-file" <$MH_TEST_DIR/prompter-file </dev/null + +runandcheck "cat $MH_TEST_DIR/prompter-file" <&2 + failed=`expr ${failed:-0} + 1`;; +esac + +# check unknown switch +runandcheck "rcvdist -nonexistent" < "$mts_fakesendmail" +printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail" +MHMTSCONF="$mts_fakesendmail" + +# arguments: rcvdist switches +test_rcvdist () +{ + run_prog $rcvdist "$@" + + # fakesendmail drops the message and any cc's into this mbox. + mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox + inc -silent -file "$mbox" + rm -f "$mbox" "$mbox.map" + + # It's hard to calculate the exact Date: header post is going to + # use, so we'll just use sed to remove the actual date so we can + # easily compare it against our "correct" output. + sed -e 's/^Resent-Date:.*/Resent-Date:/' `mhpath last` > "$actual" + + check "$expected" "$actual" +} + +# check with address +cat > "$expected" < +To: Some User +Date: Fri, 29 Sep 2006 00:00:00 +Message-Id: 1@test.nmh +Subject: Testing message 1 +Resent-From: `${MH_LIBEXEC_DIR}/ap -format '%(localmbox)' 0 | \ + sed 's/^<\(.*\)>$/\1/'` +Resent-To: recipient@example.com +Resent-Date: + +This is message number 1 +EOF + +test_rcvdist recipient@example.com < "$MH_TEST_DIR/Mail/inbox/1" + +# check -form +cat > "$expected" < +To: Some User +Date: Fri, 29 Sep 2006 00:00:00 +Message-Id: 2@test.nmh +Subject: Testing message 2 +Resent-To: recipient@example.com +Resent-From: Some User +Resent-Date: + +This is message number 2 +EOF + +cat > "$MH_TEST_DIR/Mail/rcvdistcomps" <<'EOF' +%(lit)%(formataddr{addresses})\ +%<(nonnull)%(void(width))%(putaddr Resent-To:)%> +%(lit)%(formataddr{to})\ +%<(nonnull)%(void(width))%(putaddr Resent-From:)\n%> +EOF + +test_rcvdist -form "$MH_TEST_DIR/Mail/rcvdistcomps" recipient@example.com \ + < "$MH_TEST_DIR/Mail/inbox/2" + diff --git a/test/tests/rcv/test-rcvpack b/test/tests/rcv/test-rcvpack new file mode 100755 index 0000000..357eb01 --- /dev/null +++ b/test/tests/rcv/test-rcvpack @@ -0,0 +1,52 @@ +#!/bin/sh +###################################################### +# +# Test rcvpack +# +###################################################### + + +. "$MH_TEST_COMMON" + + + +# check -help +runandcheck "rcvpack -help" <&2 + failed=`expr ${failed:-0} + 1`;; +esac + +# check unknown switch +runandcheck "rcvpack -nonexistent" <&2 + failed=`expr ${failed:-0} + 1`;; +esac + + +# check unknown switch +runandcheck "rcvstore -nonexistent" <>"`mhparam defpath`" +runandcheck "rcvstore <$MH_TEST_DIR/Mail/inbox/1" < $expected < $expected </dev/null +runandcheck "scan" <N 5 Test5 Fri Sep 29 00:00 Testing message 5 + N 6 Test6 Fri Sep 29 00:00 Testing message 6 + N 7 Test7 Fri Sep 29 00:00 Testing message 7 + N 8 Test8 Fri Sep 29 00:00 Testing message 8 + N 9 Test9 Fri Sep 29 00:00 Testing message 9 + N 10 Test10 Fri Sep 29 00:00 Testing message 10 +! -scan -width 80 +inbox > $actual -diff -u $expected $actual +runandcheck "scan -form '=%(msg) %{from}' 1-c" < +2 Test2 +3 Test3 +4 Test4 +5 Test5 +! diff --git a/test/tests/scan/test-scan-multibyte b/test/tests/scan/test-scan-multibyte new file mode 100644 index 0000000..ee3e434 --- /dev/null +++ b/test/tests/scan/test-scan-multibyte @@ -0,0 +1,41 @@ +#!/bin/sh +# +# test scan(1) with multibytes + +. $MH_TEST_COMMON + +require_locale en_US.utf-8 en_US.utf8 +LC_ALL=en_US.UTF-8 +export LC_ALL + + +cat >"$MH_TEST_DIR/Mail/inbox/11" < +Date: Mon, 22 Sep 2014 01:17:05 +0200 +Message-Id: <83C54147-7D2B-4B7F-9502-11C1EB9526BC@example.org> +To: Alice +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; + charset=iso-8859-1 + +Hallo Alice, + +hier ist dein Schl=FCssel, ich hoffe das Signieren hat funktioniert. = +Mein =F6ffentlicher Schl=FCssel liegt auf dem Keyserver. + +Viele Gr=FC=DFe +Bob + +! + +runandcheck "scan 11 +inbox" <"$MH_TEST_DIR/Mail/inbox/11" < +Date: Mon, 22 Sep 2014 01:17:05 +0200 +Message-Id: <83C54147-7D2B-4B7F-9502-11C1EB9526BC@example.org> +To: Alice +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; + charset=iso-8859-1 + +Hallo Alice, + +hier ist dein Schl=FCssel, ich hoffe das Signieren hat funktioniert. = +Mein =F6ffentlicher Schl=FCssel liegt auf dem Keyserver. + +Viele Gr=FC=DFe +Bob +! + +runandcheck "show 11 +inbox" < +To: Alice +Subject: Schlüssel + +part text/plain 151 +Hallo Alice, + +hier ist dein Schlüssel, ich hoffe das Signieren hat funktioniert. \ +Mein öffentlicher Schlüssel liegt auf dem Keyserver. + +Viele Grüße +Bob +! -- 1.7.10.4