X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/7219cad5c27edb3ebf63b5354508a66a95bc02d6..986abcee996d486db0b9c753974f3cb0eac2e9b2:/test/dist/test-dist diff --git a/test/dist/test-dist b/test/dist/test-dist index 190aeeb0..496986f5 100755 --- a/test/dist/test-dist +++ b/test/dist/test-dist @@ -16,11 +16,33 @@ fi setup_test +check_exit '-eq 1' dist - +check_exit '-eq 1' dist -editor +check_exit '-eq 1' dist -editor foo -editor +check_exit '-eq 1' dist -nowhatnowproc -whatnowproc foo -whatnowproc +check_exit '-eq 1' dist -file +check_exit '-eq 1' dist -file foo -file bar +check_exit '-eq 1' dist -form +check_exit '-eq 1' dist -draftfolder +check_exit '-eq 1' dist -draftfolder foo -draftfolder bar +check_exit '-eq 1' dist -draftmessage +check_exit '-eq 1' dist -draftmessage 42 -draftmessage 314 +check_exit '-eq 1' dist -from +check_exit '-eq 1' dist -to +check_exit '-eq 1' dist -cc +check_exit '-eq 1' dist -fcc +check_exit '-eq 1' dist -width +check_exit '-eq 1' dist -width 42 -width 0 +check_exit '-eq 1' dist -atfile -noatfile - +check_exit '-eq 1' dist + @ +check_exit '-eq 1' dist 42 314 +check_exit '-eq 1' dist -file foo 42 + expected=$MH_TEST_DIR/$$.expected expected_err=$MH_TEST_DIR/$$.expected_err actual=$MH_TEST_DIR/$$.actual actual_err=$MH_TEST_DIR/$$.actual_err -localmbox=`${MH_LIB_DIR}/ap -format "%(localmbox)" 0 | sed -e 's/^$//;'` +localmbox=`${MH_LIBEXEC_DIR}/ap -format "%(localmbox)" 0 | sed 's/^<\(.*\)>$/\1/'` #### Use sendmail/pipe below to override default mts. mts_fakesendmail="${MHMTSCONF}-fakesendmail" @@ -31,12 +53,12 @@ MHMTSCONF="$mts_fakesendmail" # arguments: dist switches test_dist () { - printf 'send\n' | dist "$@" >/dev/null + printf 'send\n' | run_prog dist "$@" >/dev/null # 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" + rm -f "$mbox" # 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 @@ -71,7 +93,8 @@ Usage: dist [+folder] [msg] [switches] -[no]atfile EOF -dist -help >"$actual" 2>&1 +#### Skip nmh intro text. +dist -help | sed '/^$/,$d' >"$actual" 2>&1 check "$expected" "$actual" # check -version @@ -247,21 +270,21 @@ EOF # check -inplace # Hard link the message and verify that the new one does get annotated. - ln "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link" + ln "${MH_TEST_DIR}/Mail/inbox/9" "${MH_TEST_DIR}/Mail/inbox/9.link" cat >"$expected" < +From: Test9 To: Some User Date: Fri, 29 Sep 2006 00:00:00 -Message-Id: 8@test.nmh -Subject: Testing message 8 +Message-Id: 9@test.nmh +Subject: Testing message 9 Resent-From: ${localmbox} Resent-To: somebody@example.com Resent-Date: -This is message number 8 +This is message number 9 EOF - test_dist 8 -noedit -to somebody@example.com -annotate -noinplace -inplace - check "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link" + test_dist 9 -noedit -to somebody@example.com -annotate -noinplace -inplace + check "${MH_TEST_DIR}/Mail/inbox/9" "${MH_TEST_DIR}/Mail/inbox/9.link" fi # check -draftfolder @@ -366,7 +389,7 @@ This is message number 1 EOF test_dist 1 -noedit -to somebody@example.com -fcc outbox -run_test 'scan +outbox -width 6' ' 1 ' +run_test 'scan +outbox -width 6' ' 1 ' cat >"$expected" < @@ -382,7 +405,28 @@ This is message number 1 EOF test_dist +inbox 1 -noedit -to somebody@example.com -fcc +outbox -run_test 'scan +outbox -width 6 2' ' 2 ' +run_test 'scan +outbox -width 6 2' ' 2 ' + +# +# Check that dist encodes headers using RFC-2047 properly +# + +require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8 + +cat >"$expected" < +To: Some User +Date: Fri, 29 Sep 2006 00:00:00 +Message-Id: 1@test.nmh +Subject: Testing message 1 +Resent-From: =?UTF-8?Q?Mr_F=C3=B8o_Bar?= +Resent-To: =?UTF-8?Q?Mr_Nobod=C3=BF?= +Resent-Date: + +This is message number 1 +EOF +test_dist +inbox 1 -noedit -from 'Mr Føo Bar ' \ + -to 'Mr Nobodÿ ' -fcc +outbox exit ${failed:-0}