# check -help
+start_test "-help"
cat >"$expected" <<EOF
Usage: dist [+folder] [msg] [switches]
switches are:
EOF
#### Skip nmh intro text.
-dist -help | sed '/^$/,$d' >"$actual" 2>&1
+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
esac
# check unknown switch
+start_test "unknown switch"
run_test "dist -nonexistent" 'dist: -nonexistent unknown'
folder +outbox -create -fast >/dev/null
# looks correct.
# check basic dist operation, including -noedit and -to
+start_test "basic dist operation, including -noedit and -to"
cat >"$expected" <<EOF
From: Test1 <test1@example.com>
To: Some User <user@example.com>
test_dist -noedit -to somebody@example.com
# check +folder and msg
+start_test "+folder and msg"
folder +outbox -fast >/dev/null
cat >"$expected" <<EOF
test_dist +inbox 1 -noedit -to somebody@example.com
# check -form
+start_test "-form"
cat >"${MH_TEST_DIR}/Mail/distform" <<'EOF'
Resent-From: me@example.com
Resent-To: you@example.com
rm "${MH_TEST_DIR}"/Mail/distform
# check -annotate
+start_test "-annotate"
cat >"$expected" <<EOF
From: Test2 <test2@example.com>
To: Some User <user@example.com>
check "$expected" "$actual"
# check -noannotate
+start_test "-noannotate"
cat >"$expected" <<EOF
From: Test1 <test1@example.com>
To: Some User <user@example.com>
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"
'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" <<EOF
fi
# check -draftfolder
+start_test "-draftfolder"
cat >"$expected" <<EOF
From: Test3 <test3@example.com>
To: Some User <user@example.com>
test_dist 3 -noedit -to somebody@example.com -draftfolder drafts
# check -draftmsg
+start_test "-draftmsg"
cat >"$expected" <<EOF
From: Test3 <test3@example.com>
To: Some User <user@example.com>
test_dist 3 -noedit -to somebody@example.com -draftfolder drafts -draftmessage 2
# check -nodraftfolder
+start_test "-nodraftfolder"
cat >"$expected" <<EOF
From: Test3 <test3@example.com>
To: Some User <user@example.com>
fi
# check -from
+start_test "-from"
cat >"$expected" <<EOF
From: Test1 <test1@example.com>
To: Some User <user@example.com>
test_dist 1 -noedit -to somebody@example.com -from me@example.com
# check -cc
+start_test "-cc"
cat >"$expected" <<EOF
From: Test1 <test1@example.com>
To: Some User <user@example.com>
test_dist 1 -noedit -to somebody@example.com -cc cc@example.com
# check -fcc
+start_test "-fcc"
cat >"$expected" <<EOF
From: Test1 <test1@example.com>
To: Some User <user@example.com>
test_dist 1 -noedit -to somebody@example.com -fcc outbox
run_test 'scan +outbox -width 6' ' 1 '
+# check -fcc with +
+start_test "-fcc with +"
cat >"$expected" <<EOF
From: Test1 <test1@example.com>
To: Some User <user@example.com>
test_dist +inbox 1 -noedit -to somebody@example.com -fcc +outbox
run_test 'scan +outbox -width 6 2' ' 2 '
+# check Distribute- and Distribution-
+start_test "Distribute- and Distribution-"
+cat >"$expected" <<EOF
+ -- Network Recipients --
+ dist-recipient at example.com
+EOF
+
+folder -f +inbox >/dev/null
+arith_eval `pick last` + 1
+new_msg=$arith_val
+cat >`mhpath new` <<EOF
+From: Test$new_msg <test$new_msg@example.com>
+Date: Sun, 10 May 2020 10:00:00
+EOF
+
+cat >`mhpath new` <<EOF
+Distribution-From: <a@example.com>
+Distribute-To: <dist-recipient@example.com>
+EOF
+
+mhdist=`pick last` mhaltmsg=`mhpath $new_msg` whom `mhpath last` >"$actual"
+check "$expected" "$actual"
+
#
# Check that dist encodes headers using RFC-2047 properly
#
-
+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" <<EOF
test_dist +inbox 1 -noedit -from 'Mr Føo Bar <resent-from@example.com>' \
-to 'Mr Nobodÿ <resent-to@example.com>' -fcc +outbox
+finish_test
exit ${failed:-0}