X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/4f000e87bba1d63933868f290db22d77a7f0b4db..7540f02725475698a47046ebf4e55b3e8dea5ab6:/test/dist/test-dist diff --git a/test/dist/test-dist b/test/dist/test-dist index c082b5e3..722d8719 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 's/^<\(.*\)>$/\1/'` +localmbox=`${MH_LIBEXEC_DIR}/ap -format "%(localmbox)" 0 | sed 's/^<\(.*\)>$/\1/'` #### Use sendmail/pipe below to override default mts. mts_fakesendmail="${MHMTSCONF}-fakesendmail" @@ -36,7 +58,7 @@ test_dist () # 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 @@ -48,6 +70,7 @@ test_dist () # check -help +start_test "-help" cat >"$expected" <"$actual" 2>&1 +#### Skip nmh intro text. +dist -help 2>&1 | sed '/^$/,$d' >"$actual" check "$expected" "$actual" # check -version +start_test "-version" case `dist -v` in dist\ --*) ;; * ) printf '%s: dist -v generated unexpected output\n' "$0" >&2 @@ -82,6 +107,7 @@ case `dist -v` in esac # check unknown switch +start_test "unknown switch" run_test "dist -nonexistent" 'dist: -nonexistent unknown' folder +outbox -create -fast >/dev/null @@ -91,6 +117,7 @@ folder +inbox -fast 1 >/dev/null # looks correct. # check basic dist operation, including -noedit and -to +start_test "basic dist operation, including -noedit and -to" cat >"$expected" < To: Some User @@ -107,6 +134,7 @@ EOF test_dist -noedit -to somebody@example.com # check +folder and msg +start_test "+folder and msg" folder +outbox -fast >/dev/null cat >"$expected" <"${MH_TEST_DIR}/Mail/distform" <<'EOF' Resent-From: me@example.com Resent-To: you@example.com @@ -148,6 +177,7 @@ test_dist 1 -noedit -form "${MH_TEST_DIR}"/Mail/distform rm "${MH_TEST_DIR}"/Mail/distform # check -annotate +start_test "-annotate" cat >"$expected" < To: Some User @@ -195,6 +225,7 @@ sed -e 's/^Resent:.*:.*/Resent:/' "${MH_TEST_DIR}"/Mail/inbox/2 >"$actual" check "$expected" "$actual" # check -noannotate +start_test "-noannotate" cat >"$expected" < To: Some User @@ -225,6 +256,7 @@ check "${MH_TEST_DIR}"/Mail/inbox/1 "$expected" 'keep first' check_for_hard_links if [ $hard_links_supported -eq 1 ]; then # check -noinplace + start_test "-noinplace" # Hard link the message and verify that the new one doesn't get annotated. cp "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.copy" ln "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link" @@ -246,6 +278,7 @@ EOF 'keep first' # check -inplace + start_test "-inplace" # Hard link the message and verify that the new one does get annotated. ln "${MH_TEST_DIR}/Mail/inbox/9" "${MH_TEST_DIR}/Mail/inbox/9.link" cat >"$expected" <"$expected" < To: Some User @@ -281,6 +315,7 @@ EOF test_dist 3 -noedit -to somebody@example.com -draftfolder drafts # check -draftmsg +start_test "-draftmsg" cat >"$expected" < To: Some User @@ -298,6 +333,7 @@ touch $MH_TEST_DIR/Mail/drafts/3 test_dist 3 -noedit -to somebody@example.com -draftfolder drafts -draftmessage 2 # check -nodraftfolder +start_test "-nodraftfolder" cat >"$expected" < To: Some User @@ -319,6 +355,7 @@ if test -d "${MH_TEST_DIR}/Mail/nonexistent"; then fi # check -from +start_test "-from" cat >"$expected" < To: Some User @@ -335,6 +372,7 @@ EOF test_dist 1 -noedit -to somebody@example.com -from me@example.com # check -cc +start_test "-cc" cat >"$expected" < To: Some User @@ -352,6 +390,7 @@ EOF test_dist 1 -noedit -to somebody@example.com -cc cc@example.com # check -fcc +start_test "-fcc" cat >"$expected" < To: Some User @@ -366,8 +405,10 @@ 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 ' +# check -fcc with + +start_test "-fcc with +" cat >"$expected" < To: Some User @@ -382,13 +423,36 @@ 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 Distribute- and Distribution- +start_test "Distribute- and Distribution-" +cat >"$expected" </dev/null +arith_eval `pick last` + 1 +new_msg=$arith_val +cat >`mhpath new` < +Date: Sun, 10 May 2020 10:00:00 +EOF + +cat >`mhpath new` < +Distribute-To: +EOF + +mhdist=`pick last` mhaltmsg=`mhpath $new_msg` whom `mhpath last` >"$actual" +check "$expected" "$actual" # # Check that dist encodes headers using RFC-2047 properly # - -LC_ALL=en_US.UTF-8; export LC_ALL +start_test "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" < @@ -396,14 +460,15 @@ 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-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 +test_dist +inbox 1 -noedit -from 'Mr Føo Bar ' \ + -to 'Mr Nobodÿ ' -fcc +outbox +finish_test exit ${failed:-0}