# check -help
+start_test "-help"
cat >$expected <<EOF
Usage: ali [switches] aliases ...
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `ali -v` in
ali\ --*) ;;
* ) echo "$0: ali -v generated unexpected output" 1>&2
esac
# check unknown option
+start_test "unknown option"
run_test 'ali -nonexistent' 'ali: -nonexistent unknown'
# check with no arguments and no AliasFile profile component
+start_test "with no arguments and no AliasFile profile component"
run_test 'ali' ''
# check with nonexistent alias file
+start_test "with nonexistent alias file"
run_test 'ali -alias nonexistent' \
"ali: aliasing error in nonexistent - unable to read 'nonexistent'"
EOF
# check -alias
+start_test "-alias"
run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases" \
'me: me@example.com
rush: geddy@example.com, alex@example.com, neil@example.com
neil: neil@example.com'
# check for a specific alias
+start_test "for a specific alias"
run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases rush" \
'geddy@example.com, alex@example.com, neil@example.com'
# check for a specific alias that doesn't exist
+start_test "for a specific alias that doesn't exist"
run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases nonexistent" \
'nonexistent'
# check -list
+start_test "-list"
run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases -list" \
'me: me@example.com
rush: geddy@example.com
neil: neil@example.com'
# check -nolist, which is the default
+start_test "-nolist, which is the default"
run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases -list -nolist" \
'me: me@example.com
rush: geddy@example.com, alex@example.com, neil@example.com
neil: neil@example.com'
# check -user
+start_test "-user"
run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases -user geddy@example.com" \
'rush, geddy'
# check -nouser
+start_test "-nouser"
run_test \
"ali -alias ${MH_TEST_DIR}/Mail/aliases -user -nouser geddy@example.com" \
'geddy@example.com'
# check expansion of first address of blind list [Bug #15604]
+start_test "expansion of first address of blind list [Bug #15604]"
cat >"${MH_TEST_DIR}/Mail/aliases" <<EOF
rush: Rush: geddy, alex, neil
geddy: geddy@example.com
'Rush: geddy@example.com, alex@example.com, neil@example.com'
# check that aliases followed by ; are not expanded [Bug #15604]
+start_test "that aliases followed by ; are not expanded [Bug #15604]"
cat >"${MH_TEST_DIR}/Mail/aliases" <<EOF
rush: Rush: geddy, alex, neil;
geddy: geddy@example.com
run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases rush" \
'Rush: geddy@example.com, alex@example.com, neil;'
-
+finish_test
exit $failed
actual_err=$MH_TEST_DIR/$$.actual_err
# check -help
+start_test "-help"
cat >"$expected" <<EOF
Usage: anno [+folder] [msgs] [switches]
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `anno -v` in
anno\ --*) ;;
* ) printf '%s: anno -v generated unexpected output\n' "$0" >&2
esac
# check unknown switch
+start_test "unknown switch"
run_test "anno -nonexistent" 'anno: -nonexistent unknown'
cat "${MH_TEST_DIR}/Mail/inbox/1" >"${MH_TEST_DIR}/Mail/inbox/11"
# check with no switches
+start_test "with no switches"
printf 'Nmh-test:\n' >"$expected"
cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
folder -fast 1 >/dev/null
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -component
+start_test "-component"
run_prog anno -component Nmh-test
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
check "$expected" "$actual" 'keep first'
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check +folder
+start_test "+folder"
run_prog anno -component Nmh-test +inbox
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
check "$expected" "$actual" 'keep first'
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check msg
+start_test "msg"
folder -fast 2 >/dev/null
run_prog anno 1 -component Nmh-test
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
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/8" "${MH_TEST_DIR}/Mail/inbox/8.link"
run_prog anno 8 -component Nmh-test -noinplace -inplace
fi
# check -nodate. Without -text, it doesn't change the message.
+start_test "-nodate. Without -text, it doesn't change the message."
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "$expected-nodate"
run_prog anno 1 -component Nmh-test -nodate
cp -f "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -date
+start_test "-date"
run_prog anno 1 -component Nmh-test -nodate -date
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
check "$expected" "$actual" 'keep first'
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -draft.
+start_test "-draft."
cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/draft"
run_prog anno -draft -component Nmh-test
sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/draft" >"$actual"
rm "${MH_TEST_DIR}/Mail/draft"
# check -append
+start_test "-append"
sed -e 's/\(Subject: Testing message 1\)/\1\
Nmh-test:/' <"${MH_TEST_DIR}/Mail/inbox/1" >"$expected"
run_prog anno 1 -component Nmh-test -append
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -list
+start_test "-list"
printf 'Nmh-test: test of anno -list\n' >"$expected"
cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
run_prog anno 1 -component Nmh-test -nodate -text 'test of anno -list'
run_test 'anno 1 -component Nmh-test -list' 'test of anno -list'
# check -text
+start_test "-text"
check "$expected" "${MH_TEST_DIR}/Mail/inbox/1"
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -list -number
+start_test "-list -number"
printf 'Nmh-test: test of anno -list -number\n' >"$expected"
cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
run_prog anno 1 -component Nmh-test -nodate -text 'test of anno -list -number'
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -delete
+start_test "-delete"
cp "${MH_TEST_DIR}/Mail/inbox/1" "$expected"
run_prog anno 1 -component Nmh-test
run_prog anno 1 -component Nmh-test -delete
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -delete -number
+start_test "-delete -number"
printf 'Nmh-test: 1\nNmh-test: 3\n' >"$expected"
cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
run_prog anno 1 -component Nmh-test -nodate -text 3
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -delete -all
+start_test "-delete -all"
cp "${MH_TEST_DIR}/Mail/inbox/1" "$expected"
run_prog anno 1 -component Nmh-test -nodate -text 3
run_prog anno 1 -component Nmh-test -nodate -text 2
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -preserve
+start_test "-preserve"
touch -t '201210010000.00' "${MH_TEST_DIR}/Mail/inbox/1"
ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls1"
run_prog anno 1 -component Nmh-test -preserve
cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
# check -nopreserve
+start_test "-nopreserve"
touch -t '2012100100.00' "${MH_TEST_DIR}/Mail/inbox/1"
ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls1"
run_prog anno 1 -component Nmh-test -preserve -nopreserve
rm "$actual-ls1" "$actual-ls2"
+finish_test
exit ${failed:-0}
# check -help
+start_test "-help"
cat >"$expected" <<EOF
Usage: packf [+folder] [msgs] [switches]
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `packf -v` in
packf\ --*) ;;
* ) printf '%s: packf -v generated unexpected output\n' "$0" >&2
esac
# check unknown switch
+start_test "unknown switch"
run_test "packf -nonexistent" 'packf: -nonexistent unknown'
cd "${MH_TEST_DIR}" || exit 1
printf 'y\n' >Mail/yes
# check with no switches
+start_test "with no switches"
run_prog packf <Mail/yes
inc +inbox2 -file msgbox <Mail/yes >/dev/null
rm -f msgbox
rmm +inbox2 -unlink `pick +inbox2`
# check +folder
+start_test "+folder"
run_prog packf +inbox <Mail/yes
inc +inbox2 -file msgbox >/dev/null
rm -f msgbox
rmm +inbox2 -unlink `pick +inbox2`
# check msgs
+start_test "msgs"
run_prog packf +inbox 1 2 3 <Mail/yes
inc +inbox2 -file msgbox >/dev/null
rm -f msgbox
rmm +inbox2 -unlink `pick +inbox2`
# check -file
+start_test "-file"
run_prog packf +inbox -file msgbox2 <Mail/yes
inc +inbox2 -file msgbox2 >/dev/null
for i in `pick +inbox2`; do
rmm +inbox2 -unlink `pick +inbox2`
# check append to existing mbox file
+start_test "append to existing mbox file"
run_prog packf +inbox -file msgbox2 <Mail/yes
inc +inbox2 -file msgbox2 >/dev/null
rm -f msgbox2
rmm +inbox2 -unlink `pick +inbox2`
# check -mbox
+start_test "-mbox"
run_prog packf +inbox -mbox <Mail/yes
inc +inbox2 -file msgbox >/dev/null
rm -f msgbox
rmm +inbox2 -unlink `pick +inbox2`
# check -mmdf
+start_test "-mmdf"
run_prog packf +inbox -mmdf <Mail/yes
inc +inbox2 -file msgbox >/dev/null
rm -f msgbox
rmm +inbox2 -unlink `pick +inbox2`
# check append to existing mmdf file
+start_test "append to existing mmdf file"
run_prog packf +inbox -mmdf <Mail/yes
inc +inbox2 -file msgbox >/dev/null
rm -f msgbox
rmm +inbox2 -unlink `pick +inbox2`
+finish_test
exit ${failed:-0}
cd $MH_TEST_DIR
# check -help
+start_test "-help"
cat >"$expected" <<EOF
Usage: sortm [+folder] [msgs] [switches]
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `sortm -version` in
sortm\ --*) ;;
* ) echo "$0: sortm -v generated unexpected output" 1>&2
EOF
# check with no options
+start_test "with no options"
cat >"$expected" <<EOF
1 09/28 Test12 common subject<<This is message number 12 >>
2 09/29 Test1 Testing message 1<<This is message number 1 >>
check "$expected" "$actual"
# check +folder
+start_test "+folder"
cat >"$expected" <<EOF
1 09/28 Test12 common subject<<This is message number 12 >>
2+ 09/29 Test1 Testing message 1<<This is message number 1 >>
check "$expected" "$actual"
# check -verbose
+start_test "-verbose"
cat >"$expected" <<EOF
sorting by datefield date
renaming message chain from 12 to 1
check "$expected" "$actual"
# check -noverbose
+start_test "-noverbose"
cat >"$expected" <<EOF
1 09/28 Test12 common subject<<This is message number 12 >>
2+ 09/29 Test1 Testing message 1<<This is message number 1 >>
check "$expected" "$actual"
# check msgs
+start_test "msgs"
cat >"$expected" <<EOF
1 09/28 Test12 common subject<<This is message number 12 >>
2 09/29 Test2 Testing message 2<<This is message number 2 >>
check "$expected" "$actual"
# check -datefield
+start_test "-datefield"
cat >"$expected" <<EOF
1 09/29 Test11 Re: common subject<<This is message number 11 >>
2 09/29 Test2 Testing message 2<<This is message number 2 >>
check "$expected" "$actual"
# check -textfield subject (datefield major, subjects grouped)
+start_test "-textfield subject (datefield major, subjects grouped)"
cat >"$expected" <<EOF
1 09/28 Test12 common subject<<This is message number 12 >>
2 09/29 Test11 Re: common subject<<This is message number 11 >>
check "$expected" "$actual"
# check -nolimit
+start_test "-nolimit"
cat >"$expected" <<EOF
1 09/28 Test12 common subject<<This is message number 12 >>
2 09/29 Test11 Re: common subject<<This is message number 11 >>
check "$expected" "$actual"
# check -textfield subject -limit 0 (subject sort)
+start_test "-textfield subject -limit 0 (subject sort)"
cat >"$expected" <<EOF
1 09/29 Test11 Re: common subject<<This is message number 11 >>
2 09/28 Test12 common subject<<This is message number 12 >>
check "$expected" "$actual"
# check -textfield -limit 0 (text sort)
+start_test "-textfield -limit 0 (text sort)"
cat >"$expected" <<EOF
1 09/29 Test10 Testing message 10<<This is message number 10 >>
2 09/29 Test11 Re: common subject<<This is message number 11 >>
check "$expected" "$actual"
# check -textfield with finite -limit that doesn't cover message 13
+start_test "-textfield with finite -limit that doesn't cover message 13"
cat >$MH_TEST_DIR/Mail/inbox/13 <<EOF || exit 1
From: Test13 <test13@example.com>
To: Some User <user@example.com>
check "$expected" "$actual"
# check -textfield with finite -limit that does cover message 13
+start_test "-textfield with finite -limit that does cover message 13"
cat >"$expected" <<EOF
1 09/28 Test12 common subject<<This is message number 12 >>
2 09/29 Test11 Re: common subject<<This is message number 11 >>
check "$expected" "$actual"
# check -notextfield
+start_test "-notextfield"
cat >"$expected" <<EOF
1 09/28 Test12 common subject<<This is message number 12 >>
2 09/29 Test10 Testing message 10<<This is message number 10 >>
check "$expected" "$actual"
# check -noall
+start_test "-noall"
run_test 'sortm -noall' 'sortm: must specify messages to sort with -noall'
# check -all
+start_test "-all"
cat >"$expected" <<EOF
1 09/28 Test12 common subject<<This is message number 12 >>
2+ 09/29 Test10 Testing message 10<<This is message number 10 >>
check "$expected" "$actual"
# check -check
+start_test "-check"
cat >"$expected" <<EOF
sortm: can't parse date field in message 14, will use file modification time
sortm: errors found, no messages sorted
check "$expected" "$actual"
# check -nocheck
+start_test "-nocheck"
cat >"$expected" <<EOF
1 09/28 Test12 common subject<<This is message number 12 >>
2+ 09/29 Test10 Testing message 10<<This is message number 10 >>
check "$expected" "$actual"
+finish_test
exit ${failed:-0}
# check -help
+start_test "-help"
cat >"$expected" <<EOF
Usage: dp [switches] dates ...
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `$dp -v` in
dp\ --*) ;;
* ) printf '%s: dp -v generated unexpected output\n' "$0" >&2
esac
# check unknown switch
+start_test "unknown switch"
run_test "$dp -nonexistent" 'dp: -nonexistent unknown'
# check with no switches
+start_test "with no switches"
run_test "$dp" 'dp: usage: dp [switches] dates ...'
# check with one valid date
+start_test "with one valid date"
cat >"$expected" <<EOF
Sun, 01 Jul 2012 00:00:00
EOF
check "$expected" "$actual"
# check with two valid dates
+start_test "with two valid dates"
cat >"$expected" <<EOF
Sun, 01 Jul 2012 00:00:00
Mon, 02 Jul 2012 00:00:00
check "$expected" "$actual"
# check with invalid date
+start_test "with invalid date"
cat >"$expected" <<EOF
error: not a date
EOF
check "$expected_err" "$actual_err"
# check -form
+start_test "-form"
form="${MH_TEST_DIR}/Mail/dp-form"
cat >"$form" <<'EOF'
%(day{text})
rm -f "$form"
# check -format
+start_test "-format"
cat >"$expected" <<EOF
Sun
EOF
check $expected $actual
# check -width
+start_test "-width"
cat >"$expected" <<EOF
Sun, 01 Jul 2012
EOF
check "$expected" "$actual"
+finish_test
exit ${failed:-0}
# check -help
+start_test "-help"
cat >$expected <<EOF
Usage: fmtdump [switches]
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `$fmtdump -v` in
fmtdump\ --*) ;;
* ) printf '%s: fmtdump -v generated unexpected output\n' "$0" >&2
esac
# check unknown switch
+start_test "unknown switch"
run_test "$fmtdump -nonexistent" 'fmtdump: -nonexistent unknown'
# check with no switches
+start_test "with no switches"
cat >$expected <<EOF
LV_DAT, value dat[0]
NUMF, width 4, fill ' '
check $expected $actual
# check -form
+start_test "-form"
cat >$expected <<EOF
LV_DAT, value dat[0]
NUMF, width 4, fill ' '
check $expected $actual
# check -format
+start_test "-format"
cat >$expected <<EOF
LS_LIT str "1234567890"
IF_S continue else goto L0
check $expected $actual
+finish_test
exit ${failed:-0}
actual="$MH_TEST_DIR/test-functions$$.actual"
# check sday when day of week is specified
+start_test "sday when day of week is specified"
printf '1\n' >"$expected"
fmttest -raw -format '%(sday{text})' 'Fri Sep 12 20:02 2014' >"$actual"
check "$expected" "$actual"
# check sday when day of week is not specified
+start_test "sday when day of week is not specified"
printf '0\n' >"$expected"
fmttest -raw -format '%(sday{text})' 'Sep 12 20:02 2014' >"$actual"
check "$expected" "$actual"
# check negative number, without padding
+start_test "negative number, without padding"
printf '%s\n' ' -42' >"$expected"
fmttest -raw -format '%4(minus -42)' 0 >"$actual"
check "$expected" "$actual"
# check negative number, with padding
+start_test "negative number, with padding"
# Output was "0-42" with nmh 1.6 and earlier.
printf '%s\n' -042 >"$expected"
fmttest -raw -format '%04(minus -42)' 0 >"$actual"
check "$expected" "$actual"
# check multiply
+start_test "multiply"
printf '%s\n' 42 >"$expected"
fmttest -raw -format '%(void(num 7))%(multiply 6)' 0 >"$actual"
check "$expected" "$actual"
+finish_test
exit $failed
1 "Local-Mailbox with Alternate-Mailbox test"
# check getmymbox, without match
+start_test "getmymbox, without match"
run_test 'fmttest -message -format %(getmymbox{from}) first' ''
# check getmyaddr, without match
+start_test "getmyaddr, without match"
run_test 'fmttest -message -format %(getmyaddr{from}) first' ''
grep -v 'Alternate-Mailboxes: ' "$MH" > "$MH".new
EOF
# check getmymbox, with match
+start_test "getmymbox, with match"
run_test 'fmttest -message -format %(getmymbox{from}) first' \
'Test1 <test1@example.com>'
# check getmyaddr, with match
+start_test "getmyaddr, with match"
run_test 'fmttest -message -format %(getmyaddr{from}) first' \
'test1@example.com'
# check getmymbox and getmyaddr, with match of other than first address in
+start_test "getmymbox and getmyaddr, with match of other than first address in"
# component
cat >`mhpath new` <<'EOF'
From: Test11 <test11@example.com>
run_test 'fmttest -message -format %(getmyaddr{cc}) last' \
'test1@example.com'
+finish_test
exit $failed
" 11+ 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And why not, the man's entitled to it. Cost"
# check header field name with ':' character than lands on m_getfld() buffer
+start_test "header field name with ':' character than lands on m_getfld() buffer"
cat >"$MH_TEST_DIR/mess" <<EOF
Comments: The important characteristic of this message is that the 8193'rd
Comments: byte is the ':' at the end of header field name. That tests some
rm -f "$MH_TEST_DIR/mess"
# check m_getfld() handling of fields with trailing whitespace
+start_test "m_getfld() handling of fields with trailing whitespace"
# Even though header field names aren't supposed to have spaces (RFC
# 28220, m_getfld () trims trailing whitespace from them.
cat >`mhpath new` <<EOF
run_test 'scan last' ' 12 12/18 foo@example.edu test'
# check header field body with more than 511 characters
+start_test "header field body with more than 511 characters"
cat >"$MH_TEST_DIR/mess" <<EOF
Comments: The important characteristic of this message is that this header
field body is more than 511 bytes long. That tests the logic in
rm -f "$MH_TEST_DIR/mess"
# check inc of message with header field body with more than 511 characters
+start_test "inc of message with header field body with more than 511 characters"
cat >"$expected" <<EOF
Comments: The important characteristic of this message is that this header
field body is more than 511 bytes long. That tests the logic in
rm -f "$MH_TEST_DIR/mess"
# check scan and inc of mbox with multiple messages
+start_test "scan and inc of mbox with multiple messages"
echo y | packf -file "$MH_TEST_DIR/msgbox"
run_test "scan -width 80 -file $MH_TEST_DIR/msgbox" \
' 1 09/29 Test1 Testing message 1<<This is message number 1 >>
rm -f "$MH_TEST_DIR/msgbox"
# check mbox with two blank lines between header and body
+start_test "mbox with two blank lines between header and body"
cat >>"$MH_TEST_DIR/msgbox" <<EOF
From
Date: Mon, 15 Apr 2013 21:02:12 -0500
rm -f "$MH_TEST_DIR/msgbox"
# check inc (m_getfld, actually) of very, very, very short message
+start_test "inc (m_getfld, actually) of very, very, very short message"
cat >>"$MH_TEST_DIR/msgbox" <<EOF
From
Date: Tue, 6 Sep 2016 08:52:32 -0400
rm -f "$MH_TEST_DIR/msgbox"
# check inc (m_getfld, actually) of very, very short message
+start_test "inc (m_getfld, actually) of very, very short message"
cat >>"$MH_TEST_DIR/msgbox" <<EOF
From
Date: Tue, 6 Sep 2016 08:52:32 -0400
rm -f "$MH_TEST_DIR/msgbox"
# check inc (m_getfld, actually) of very short message
+start_test "inc (m_getfld, actually) of very short message"
cat >>"$MH_TEST_DIR/msgbox" <<EOF
From
Date: Tue, 6 Sep 2016 08:52:32 -0400
rm -f "$MH_TEST_DIR/msgbox"
# check inc (m_getfld, actually) of short message
+start_test "inc (m_getfld, actually) of short message"
cat >>"$MH_TEST_DIR/msgbox" <<EOF
From
Date: Tue, 6 Sep 2016 08:52:32 -0400
rm -f "$MH_TEST_DIR/msgbox"
+finish_test
exit ${failed:-0}
# check -help
+start_test "-help"
# Only look at first 9 lines because the rest depend on
# whether sasl support was configured in.
cat >"$expected" <<EOF
check "$expected" "$actual"
# check -version
+start_test "-version"
case `msgchk -v` in
msgchk\ --*) ;;
* ) printf '%s: msgchk -v generated unexpected output\n' "$0" >&2
esac
# check unknown switch
+start_test "unknown switch"
run_test "msgchk -nonexistent" 'msgchk: -nonexistent unknown'
# check with no arguments and no mail waiting
+start_test "with no arguments and no mail waiting"
run_test 'msgchk' "You don't have any mail waiting"
# Use maildrop specified in mts.conf, i.e.,
"${MH_TEST_DIR}"/Mail/maildrop
# check with no arguments and mail waiting
+start_test "with no arguments and mail waiting"
cat >"$expected" <<EOF
You have new mail waiting; last read on
EOF
check "$expected" "$actual"
# check -date
+start_test "-date"
cat >"$expected" <<EOF
You have new mail waiting; last read on
EOF
check "$expected" "$actual"
# check -nodate
+start_test "-nodate"
run_test 'msgchk -nodate' 'You have new mail waiting'
# check -notify mail, when there is mail
+start_test "-notify mail, when there is mail"
run_test 'msgchk -notify mail -nodate' 'You have new mail waiting'
# check -notify nomail, when there is mail
+start_test "-notify nomail, when there is mail"
run_test 'msgchk -notify nomail -nodate' 'You have new mail waiting'
# check -notify all, when there is mail
+start_test "-notify all, when there is mail"
run_test 'msgchk -notify nomail -notify all -nodate' 'You have new mail waiting'
# check -nonotify mail, when there is mail
+start_test "-nonotify mail, when there is mail"
run_test 'msgchk -nonotify mail -nodate' ''
# check -nonotify nomail, when there is mail
+start_test "-nonotify nomail, when there is mail"
run_test 'msgchk -nonotify nomail -nodate' 'You have new mail waiting'
# check -nonotify all, when there is mail
+start_test "-nonotify all, when there is mail"
run_test 'msgchk -nonotify nomail -nonotify all -nodate' ''
run_prog inc -silent
# check -notify mail, when there is no mail
+start_test "-notify mail, when there is no mail"
run_test 'msgchk -notify mail -nodate' "You don't have any mail waiting"
# check -notify nomail, when there is no mail
+start_test "-notify nomail, when there is no mail"
run_test 'msgchk -notify nomail -nodate' "You don't have any mail waiting"
# check -notify all, when there is no mail
+start_test "-notify all, when there is no mail"
run_test 'msgchk -notify nomail -nonotify all -nodate' ''
# check -nonotify mail, when there is no mail
+start_test "-nonotify mail, when there is no mail"
run_test 'msgchk -nonotify mail -nodate' "You don't have any mail waiting"
# check -nonotify nomail, when there is no mail
+start_test "-nonotify nomail, when there is no mail"
run_test 'msgchk -nonotify nomail -nodate' ''
# check -nonotify all, when there is no mail
+start_test "-nonotify all, when there is no mail"
run_test 'msgchk -nonotify nomail -nonotify all -nodate' ''
+finish_test
exit ${failed:-0}
EOM
# Check netrc's permissions test
+start_test "netrc's permissions test"
pid=`"${MH_OBJ_DIR}/test/fakepop" "$testport" '' '' "$testmessage"`
chmod g=w,o=x $netrc
run_test "inc -user ${TESTUSER} -host 127.0.0.1 -port $testport" \
check "$testmessage" `mhpath +inbox 11` 'keep first'
# Check multiple messages at once
+start_test "multiple messages at once"
pid=`"${MH_OBJ_DIR}/test/fakepop" "$testport" \
"$TESTUSER" "$TESTPASS" "$testmessage" \
rm -f "$netrc"
# check credentials: file
+start_test "credentials: file"
# Redirect stdin so that inc doesn't wait on the user if it can't
# read the netrc file, even though that shouldn't happen.
TESTUSER=differenuser
rm -f "$netrc"
+finish_test
exit ${failed:-0}
check_exit '-eq 1' install-mh -
# check with no options, with nmh already installed
+start_test "with no options, with nmh already installed"
run_test "install-mh" \
'install-mh: You already have an nmh profile, use an editor to modify it'
# check -auto, with nmh already installed
+start_test "-auto, with nmh already installed"
run_test "install-mh -auto" 'install-mh: invocation error'
# check -check, with nmh already installed
+start_test "-check, with nmh already installed"
run_test "install-mh -check" ''
# make sure exit status is 0
run_prog install-mh -check
rm -rf $MH_TEST_DIR/Mail
# check -check, with nmh not installed
+start_test "-check, with nmh not installed"
run_test "install-mh -check" ''
# make sure exit status is 1
set +e
set -e
# check with no options, with nmh not installed. Use canned
+start_test "with no options, with nmh not installed. Use canned"
# responses to install.
installpath=`echo $MH_TEST_DIR/Mail | sed 's%^/%%'`
echo "n
fi
+finish_test
exit $failed
#
# Check out more common case, one (or more) attachments
+start_test "out more common case, one (or more) attachments"
# along with message text.
#
#
# Check a completely empty message
+start_test "a completely empty message"
#
cat > "$draft" <<EOF
check "$draft" "$expected"
# check that blank line is inserted between header and content
+start_test "that blank line is inserted between header and content"
cat > "$MH_TEST_DIR/Mail/oneline" <<EOF
There needs to be a blank line before this content line.
[ ${failed:=0} -eq 0 ] && rm -f ${backup}
+finish_test
exit ${failed:-0}
actual="$MH_TEST_DIR/$$.actual"
# check mhbuild
+start_test "mhbuild"
cat > $expected <<EOF
To:
cc:
test ${failed:-0} -eq 0 && rm "$draftorig"
# check mhbuild -rfc934
+start_test "mhbuild -rfc934"
cat > $expected <<EOF
To:
cc:
check $expected $draft
test ${failed:-0} -eq 0 && rm "$draftorig"
+finish_test
exit $failed
# check nortrim (default), and that trailing whitespace in a
+start_test "nortrim (default), and that trailing whitespace in a"
# component is trimmed when filtering blank lines
cat >"$expected" <<EOF
> There are two blank lines below. And there is a trailing space:
# check rtrim
+start_test "rtrim"
cat >"$expected" <<EOF
> There are two blank lines below. And there is a trailing space:
> And another trailing space:
rm -f "$MH_TEST_DIR/test.format"
+finish_test
exit $failed
# check -help
+start_test "-help"
# Verified behavior consistent with compiled sendmail.
cat >$expected <<EOF
Usage: mhmail [-t(o)] addrs ... [switches]
# check -version
+start_test "-version"
# Verified same behavior as compiled mhmail.
case `mhmail -v` in
mhmail\ --*) ;;
esac
# check for missing argument to switches that require them
+start_test "for missing argument to switches that require them"
for switch in attach body cc from headerfield subject to; do
run_test "mhmail recipient -$switch" \
"mhmail: missing argument to -$switch"
# check with no switches
+start_test "with no switches"
# That will just run inc, which we don't want to do anything,
# so tell inc to just display its version.
# Verified same behavior as compiled mhmail.
# check -nosend
+start_test "-nosend"
# Not supported by compiled mhmail.
mhmail -nosend recipient@example.com -from sender1@localhost \
-server 127.0.0.1 -port $localport -body '' >"$actual" 2>"$actual_err"
# check -send
+start_test "-send"
# Not supported by compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check -from
+start_test "-from"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check -from and -body
+start_test "-from and -body"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check -from and -cc
+start_test "-from and -cc"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check -from and multiple -cc addresses
+start_test "-from and multiple -cc addresses"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check -from and -subject
+start_test "-from and -subject"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check -from and -profile
+start_test "-from and -profile"
# Show that -profile causes mhmail to 1) read the profile and
# 2) use send(1) by added a send switch to the profile and
# verifying that it gets used.
# check repeated -from and -subject switches
+start_test "repeated -from and -subject switches"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
[ ${failed:-0} -eq 0 ] || exit ${failed:-0}
# check repeated -body switches
+start_test "repeated -body switches"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check multiple -cc switches
+start_test "multiple -cc switches"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check separated -cc arguments
+start_test "separated -cc arguments"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check -cc switch followed by -to switch
+start_test "-cc switch followed by -to switch"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check with no newline on stdin
+start_test "with no newline on stdin"
# Shows different behavior than compiled mhmail, which was silent in this case.
cat > "$expected" <<EOF
EOF
# check with one newline on stdin
+start_test "with one newline on stdin"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check with multiple newlines on stdin
+start_test "with multiple newlines on stdin"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check with text and no trailing newline on stdin
+start_test "with text and no trailing newline on stdin"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check with text and multiple trailing blank lines on stdin
+start_test "with text and multiple trailing blank lines on stdin"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check with no newline to -body
+start_test "with no newline to -body"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check with one newline to -body
+start_test "with one newline to -body"
# Shows different behavior than compiled mhmail, which suppressed the newline.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check with multiple newlines to -body
+start_test "with multiple newlines to -body"
# Shows different behavior than compiled mhmail, which suppressed one
# of the newlines.
cat > "$expected" <<EOF
# check with text and no trailing newline to -body
+start_test "with text and no trailing newline to -body"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check with text and multiple trailing blank lines to -body
+start_test "with text and multiple trailing blank lines to -body"
# Shows different behavior than compiled mhmail, which suppressed one
# of the newlines.
cat > "$expected" <<EOF
# check -resent
+start_test "-resent"
# Verified same behavior as compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
[ ${failed:-0} -eq 0 ] || exit ${failed:-0}
# check -resent -profile, using stdin
+start_test "-resent -profile, using stdin"
# Not supported by compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check -resent -profile, using -b
+start_test "-resent -profile, using -b"
# Not supported by compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check -headerfield.
+start_test "-headerfield."
# Not supported by compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check multiple -headerfields.
+start_test "multiple -headerfields."
# Not supported by compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
# check -attach
+start_test "-attach"
# Not supported by compiled mhmail.
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
[ ${failed:-0} -eq 0 ] || exit ${failed:-0}
+finish_test
exit ${failed:-0}
# check -help
+start_test "-help"
cat > $expected <<EOF
Usage: mhpath [+folder] [msgs] [switches]
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `mhpath -v` in
mhpath\ --*) ;;
* ) echo "$0: mhpath -v generated unexpected output" 1>&2
esac
# check +
+start_test "+"
run_test "mhpath +" "$MH_TEST_DIR/Mail"
# check with no options
+start_test "with no options"
folder -fast +inbox > /dev/null
run_test "mhpath" "$MH_TEST_DIR/Mail/inbox"
# check +inbox
+start_test "+inbox"
run_test "mhpath +inbox" "$MH_TEST_DIR/Mail/inbox"
# check all
+start_test "all"
cat > $expected <<EOF
$MH_TEST_DIR/Mail/inbox/1
$MH_TEST_DIR/Mail/inbox/2
check $expected $actual
# check message number greater than highest
+start_test "message number greater than highest"
run_test "mhpath 11" "mhpath: message 11 out of range 1-10"
run_test "mhpath 10 11" "mhpath: message 11 out of range 1-10"
# check range with message number greater than highest
+start_test "range with message number greater than highest"
cat > $expected <<EOF
$MH_TEST_DIR/Mail/inbox/1
$MH_TEST_DIR/Mail/inbox/2
check $expected $actual
# check new
+start_test "new"
run_test "mhpath new" "$MH_TEST_DIR/Mail/inbox/11"
# check multiple msgs, including new
+start_test "multiple msgs, including new"
cat > $expected <<EOF
$MH_TEST_DIR/Mail/inbox/1
$MH_TEST_DIR/Mail/inbox/10
check $expected $actual
# check invalid message list using names
+start_test "invalid message list using names"
run_test "mhpath last-new" "mhpath: bad message list last-new"
# check cur
+start_test "cur"
folder +inbox 5 > /dev/null
run_test "mhpath cur" "$MH_TEST_DIR/Mail/inbox/5"
# check prev
+start_test "prev"
run_test "mhpath prev" "$MH_TEST_DIR/Mail/inbox/4"
# check next
+start_test "next"
run_test "mhpath next" "$MH_TEST_DIR/Mail/inbox/6"
# check invalid message list using numbers
+start_test "invalid message list using numbers"
rmm 1-2
run_test "mhpath 1-2" "mhpath: no messages in range 1-2"
# check ignoring of out-of-range message numbers in ranges
+start_test "ignoring of out-of-range message numbers in ranges"
run_test "mhpath 1-3" "$MH_TEST_DIR/Mail/inbox/3"
run_test "mhpath first-3" "$MH_TEST_DIR/Mail/inbox/3"
run_test "mhpath 10-11" "$MH_TEST_DIR/Mail/inbox/10"
run_test "mhpath last-11" "$MH_TEST_DIR/Mail/inbox/10"
# check reference to existing messages
+start_test "reference to existing messages"
cat > $expected <<EOF
$MH_TEST_DIR/Mail/inbox/3
$MH_TEST_DIR/Mail/inbox/4
check $expected $actual
# check reference to non-existent messages
+start_test "reference to non-existent messages"
cat > $expected <<EOF
$MH_TEST_DIR/Mail/inbox/1
$MH_TEST_DIR/Mail/inbox/2
check $expected $actual
+finish_test
exit $failed
actual="$MH_TEST_DIR/$$.actual"
# check a boundary condition in m_getfld(): its internal message
+start_test "a boundary condition in m_getfld(): its internal message"
# buffer holds exactly up to the end of a header field body in a
# message part
msgfile=`mhpath new`
check "$expected" "$actual" : check number 1
# check a boundary condition in m_getfld(): its internal message
+start_test "a boundary condition in m_getfld(): its internal message"
# buffer holds exactly up to the end of a header field name in a
# message part
msgfile=`mhpath new`
check "$expected" "$actual" : check number 2
# check a boundary condition in m_getfld(): its internal message
+start_test "a boundary condition in m_getfld(): its internal message"
# buffer holds exactly up to the end of a message part boundary
msgfile=`mhpath new`
msgnum=`basename $msgfile`
check "$expected" "$actual" : check number 3
+finish_test
exit $failed
actual="$MH_TEST_DIR"/$$.actual
# check charset conversion
+start_test "charset conversion"
msgfile=`mhpath new`
msgnum=`basename $msgfile`
cat >"$msgfile" <<'EOF'
# check expansion of %{charset} by itself
+start_test "expansion of %{charset} by itself"
msgfile=`mhpath new`
msgnum=`basename $msgfile`
cat >"$msgfile" <<'EOF'
# check expansion of empty %{charset} by itself
+start_test "expansion of empty %{charset} by itself"
msgfile=`mhpath new`
omsgnum=$msgnum
msgnum=`basename $msgfile`
EOF
# check expansion of embedded %{charset} with no text following
+start_test "expansion of embedded %{charset} with no text following"
cat >"$expected" <<EOF
[ Message inbox:$omsgnum ]
Date: Sun, 18 Dec 2005 00:52:39 +0100
# check expansion of empty embedded %{charset} with no text following
+start_test "expansion of empty embedded %{charset} with no text following"
cat >"$expected" <<EOF
[ Message inbox:$msgnum ]
Date: Sun, 18 Dec 2005 00:52:39 +0100
mv -f "$MH.new" "$MH"
# check expansion of embedded %{charset} with text following
+start_test "expansion of embedded %{charset} with text following"
cat >"$expected" <<EOF
[ Message inbox:$omsgnum ]
Date: Sun, 18 Dec 2005 00:52:39 +0100
# check expansion of empty embedded %{charset} with text following
+start_test "expansion of empty embedded %{charset} with text following"
cat >"$expected" <<EOF
[ Message inbox:$msgnum ]
Date: Sun, 18 Dec 2005 00:52:39 +0100
mv -f "$MH.new" "$MH"
# check parameter value quoting
+start_test "parameter value quoting"
msgfile=`mhpath new`
msgnum=`basename $msgfile`
cat >"$msgfile" <<'EOF'
mv -f "$MH.new" "$MH"
# check that unknown parameter is not expanded
+start_test "that unknown parameter is not expanded"
msgfile=`mhpath new`
msgnum=`basename $msgfile`
cat >"$msgfile" <<'EOF'
EOF
# check parameter value quoting with text following
+start_test "parameter value quoting with text following"
msgfile=`mhpath new`
msgnum=`basename $msgfile`
cat >"$msgfile" <<'EOF'
check "$expected" "$actual" : parameter value quoting with text following
# check malicious parameter value quoting
+start_test "malicious parameter value quoting"
msgfile=`mhpath new`
msgnum=`basename $msgfile`
cat >"$msgfile" <<'EOF'
run_prog mhshow last >"$actual" 2>&1
check "$expected" "$actual" : large file conversion to UTF-8
+finish_test
exit $failed
# check -help
+start_test "-help"
if [ $has_mkstemps -eq 1 ]; then
cat >$expected <<-'EOF'
Usage: mkstemp [switches]
# check -version
+start_test "-version"
# Verified same behavior as compiled mhmail.
case `$mkstemp -v` in
mkstemp\ --*) ;;
# check with no switches
+start_test "with no switches"
tmpfile=`$mkstemp`
if [ -f "$tmpfile" ]; then
rm "$tmpfile"
# check -directory
+start_test "-directory"
tmpfile=`$mkstemp -directory "$MHTMPDIR"`
[ -f "$tmpfile" ] && rm "$tmpfile" || failed=`expr ${failed:-0} + 1`
# Rely on exit status of grep to detect failure and terminate due to set -e:
# check -prefix
+start_test "-prefix"
tmpfile=`$mkstemp -prefix mkstemptest`
[ -f "$tmpfile" ] && rm "$tmpfile" || failed=`expr ${failed:-0} + 1`
# Rely on exit status of grep to detect failure and terminate due to set -e:
fi
+finish_test
exit $failed
EOF
# check invalid -messageid selection
+start_test "invalid -messageid selection"
run_test "send -draft -messageid invalid" \
"post: unsupported messageid \"invalid\"
send: message not delivered to anyone"
}
# check -messageid localname (the default)
+start_test "-messageid localname (the default)"
cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
From: Mr Nobody <nobody@example.com>
To: Somebody Else <somebody@example.com>
test_messageid localname "${testname}.expected"
# check -messageid random
+start_test "-messageid random"
cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
From: Mr Nobody <nobody@example.com>
To: Somebody Else <somebody@example.com>
rm -f ${MHMTSCONF}
+finish_test
exit ${failed:-0}
# check blind list
+start_test "blind list"
cat >"${MH_TEST_DIR}/Mail/draft" <<EOF
From: Mr Nobody <nobody@example.com>
To: blind_list
"-alias ${MH_TEST_DIR}/Mail/aliases"
# check named list (alias followed by ;)
+start_test "named list (alias followed by ;)"
cat >"${MH_TEST_DIR}/Mail/draft" <<EOF
From: Mr Nobody <nobody@example.com>
To: named.list
test_alias sendmail/smtp "${testname}.expected"
# check blind list with -mts sendmail/pipe, which should fail
+start_test "blind list with -mts sendmail/pipe, which should fail"
cat >"${MH_TEST_DIR}/Mail/draft" <<EOF
From: Mr Nobody <nobody@example.com>
To: blind_list
test_alias sendmail/pipe "${testname}.expected"
# check that alias expansion happens in the From: line when doing a bcc
+start_test "that alias expansion happens in the From: line when doing a bcc"
cat >"${MH_TEST_DIR}/Mail/draft" <<EOF
From: four
To: one
"-alias ${MH_TEST_DIR}/Mail/aliases"
+finish_test
exit ${failed:-0}
# check -help
+start_test "-help"
cat >"$expected" <<EOF
Usage: sendfiles [switches] -to recipient -subject subject file1 [file2 ...]
or
check "$expected" "$actual"
# check -version
+start_test "-version"
case `sendfiles -v` in
sendfiles\ --*) ;;
* ) printf '%s: sendfiles -v generated unexpected output\n' "$0" >&2
esac
# check unknown switch
+start_test "unknown switch"
run_test 'sendfiles -nonexistent' "Usage: sendfiles [switches] -to recipient \
-subject subject file1 [file2 ...]
or
Can use PERSON environment variable instead of -from switch."
# check unknown compression method
+start_test "unknown compression method"
run_test 'sendfiles -compress unknown to subject file' \
'sendfiles: unknown compression method "unknown"'"
Usage: sendfiles [switches] -to recipient \
Can use PERSON environment variable instead of -from switch."
# Check basic operation, using specified compression method.
+start_test "basic operation, using specified compression method."
# Don't check the mhlist output, by not creating an $expected file,
# because it will vary with compression method and compressed file
# size.
[ "`findprog lzma`" ] && test_sendfiles 'lzma -cd' new -compress lzma
# check with no compression
+start_test "with no compression"
cat >"$expected" <<EOF
msg part type/subtype size description
11 application/octet-stream
test_sendfiles cat new -compress none
# check with no compression, -none
+start_test "with no compression, -none"
cat >"$expected" <<EOF
msg part type/subtype size description
11 application/octet-stream
test_sendfiles cat new -none
# check old argument style (without -to and -subject)
+start_test "old argument style (without -to and -subject)"
cat >"$expected" <<EOF
msg part type/subtype size description
11 application/octet-stream
test_sendfiles cat old -compress none
# check -from
+start_test "-from"
cat >"$expected" <<EOF
msg part type/subtype size description
11 application/octet-stream
test_sendfiles cat new -compress none -from 'Sender <sender@example.com>'
# check PERSON environment variable
+start_test "PERSON environment variable"
cat >"$expected" <<EOF
msg part type/subtype size description
11 application/octet-stream
rm -fr "$MH_TEST_DIR/fakesendmail" "$MH_TEST_DIR/$testfile" "$MH_TEST_DIR/tmp"
+finish_test
exit ${failed:-0}
# check -help
+start_test "-help"
cat >$expected <<EOF
Usage: prompter [switches] file
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `prompter -v` in
prompter\ --*) ;;
* ) printf '%s: prompter -v generated unexpected output\n' "$0" >&2
esac
# check unknown switch
+start_test "unknown switch"
run_test 'prompter -nonexistent' 'prompter: -nonexistent unknown'
# check with no switches
+start_test "with no switches"
run_test 'prompter' 'prompter: usage: prompter [switches] file'
# check with file
+start_test "with file"
cat >$expected <<EOF
Resent-From: sender@example.com
Resent-To: recipient@example.com
check "$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
# check -doteof
+start_test "-doteof"
cat >$MH_TEST_DIR/prompter-file <<EOF
Resent-From: sender@example.com
Resent-To:
check "$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
# check -nodoteof
+start_test "-nodoteof"
cat >$MH_TEST_DIR/prompter-file <<EOF
Resent-From: sender@example.com
Resent-To:
check "$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
# check -noprepend
+start_test "-noprepend"
cat >$MH_TEST_DIR/prompter-file <<EOF
Resent-From: sender@example.com
Resent-To:
check "$expected" "$MH_TEST_DIR/prompter-file"
# check -prepend
+start_test "-prepend"
cat >$MH_TEST_DIR/prompter-file <<EOF
Resent-From: sender@example.com
Resent-To:
check "$MH_TEST_DIR/prompter-file" "$expected" 'keep first'
# check -rapid
+start_test "-rapid"
cat >$expected <<EOF
Resent-From: sender@example.com
Resent-To: recipient@example.com
check "$expected" "$actual"
# check -norapid
+start_test "-norapid"
cat >$expected <<EOF
Resent-From: sender@example.com
Resent-To: recipient@example.com
check "$expected" "$actual"
# check -erase and -kill. We can't test their effects because they
+start_test "-erase and -kill. We can't test their effects because they"
# only affect the terminal and this test execution might not be
# connected to one. So we can just check that the respective options
# were set.
check "$expected" "$actual"
# check -body. It's undocumented but the default, so make sure that
+start_test "-body. It's undocumented but the default, so make sure that"
# it reverses the effect of -nobody.
cat >$expected <<EOF
Resent-From: sender@example.com
check "$expected" "$actual"
# check -nobody. It's undocumented but looks like it removes the body.
+start_test "-nobody. It's undocumented but looks like it removes the body."
cat >$expected <<EOF
Resent-From: sender@example.com
Resent-To: recipient@example.com
check "$expected" "$MH_TEST_DIR/prompter-file"
+finish_test
exit ${failed:-0}
# check -help
+start_test "-help"
cat >"$expected" <<EOF
Usage: rcvpack [switches] file
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `$rcvpack -v` in
rcvpack\ --*) ;;
* ) printf '%s: rcvpack -v generated unexpected output\n' "$0" >&2
esac
# check unknown switch
+start_test "unknown switch"
run_test "$rcvpack -nonexistent" 'rcvpack: -nonexistent unknown'
# check with no switches
+start_test "with no switches"
run_test "$rcvpack" 'rcvpack: rcvpack [switches] file'
# check mbox creation
+start_test "mbox creation"
run_prog $rcvpack <${MH_TEST_DIR}/Mail/inbox/1 ${MH_TEST_DIR}/Mail/mbox
inc -file ${MH_TEST_DIR}/Mail/mbox -silent
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -mbox
+start_test "-mbox"
run_prog $rcvpack -mmdf -mbox ${MH_TEST_DIR}/Mail/mbox2 \
<${MH_TEST_DIR}/Mail/inbox/1
# Filter out "From " lines because their timestamps can differ by a second.
check "${MH_TEST_DIR}/Mail/mbox-filt" "${MH_TEST_DIR}/Mail/mbox2-filt"
# check append to existing mbox file
+start_test "append to existing mbox file"
run_prog $rcvpack <${MH_TEST_DIR}/Mail/inbox/2 ${MH_TEST_DIR}/Mail/mbox
inc -file ${MH_TEST_DIR}/Mail/mbox -silent
check "${MH_TEST_DIR}/Mail/inbox/2" "${MH_TEST_DIR}/Mail/inbox/12" 'keep first'
# check -mmdf
+start_test "-mmdf"
run_prog $rcvpack -mmdf <${MH_TEST_DIR}/Mail/inbox/3 ${MH_TEST_DIR}/Mail/mmdf
inc -file ${MH_TEST_DIR}/Mail/mmdf -silent
check "${MH_TEST_DIR}/Mail/inbox/3" "${MH_TEST_DIR}/Mail/inbox/12" 'keep first'
# check append to existing mmdf file
+start_test "append to existing mmdf file"
run_prog $rcvpack -mmdf <${MH_TEST_DIR}/Mail/inbox/4 ${MH_TEST_DIR}/Mail/mmdf
inc -file ${MH_TEST_DIR}/Mail/mmdf -silent
check "${MH_TEST_DIR}/Mail/inbox/4" "${MH_TEST_DIR}/Mail/inbox/13" 'keep first'
+finish_test
exit ${failed:-0}
# check -help
+start_test "-help"
cat >$expected <<EOF
Usage: rcvstore [+folder] [switches]
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `$rcvstore -v` in
rcvstore\ --*) ;;
* ) printf '%s: rcvstore -v generated unexpected output\n' "$0" >&2
esac
# check unknown switch
+start_test "unknown switch"
run_test "$rcvstore -nonexistent" 'rcvstore: -nonexistent unknown'
# check with no switches and zero-length input message
+start_test "with no switches and zero-length input message"
cat >$expected <<EOF
rcvstore: empty file
EOF
check $expected $actual
# check with no switches
+start_test "with no switches"
cat >$expected <<EOF
EOF
run_prog $rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check + of existing folder
+start_test "+ of existing folder"
run_prog $rcvstore +inbox <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check + of new folder
+start_test "+ of new folder"
run_prog $rcvstore +newfolder <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/newfolder/1" \
rmdir "${MH_TEST_DIR}/Mail/newfolder"
# check -nocreate
+start_test "-nocreate"
cat >$expected_err <<EOF
rcvstore: folder ${MH_TEST_DIR}/Mail/newfolder doesn't exist
EOF
check $expected_err $actual_err
# check -create
+start_test "-create"
run_prog $rcvstore +newfolder -nocreate -create <${MH_TEST_DIR}/Mail/inbox/1 \
>$actual 2>&1
check $expected $actual 'keep first'
rmdir "${MH_TEST_DIR}/Mail/newfolder"
# check addition to unseen sequence
+start_test "addition to unseen sequence"
printf 'Unseen-Sequence: unseen\n' >> $MH
run_prog $rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
rmm 11
# check -nounseen
+start_test "-nounseen"
run_prog $rcvstore -nounseen <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence unseen -list' 'unseen: '
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -unseen
+start_test "-unseen"
run_prog $rcvstore -nounseen -unseen <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence unseen -list' 'unseen: 11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -sequence
+start_test "-sequence"
run_prog $rcvstore -sequence newseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence newseq -list' 'newseq: 11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check that default is -nozero
+start_test "that default is -nozero"
mark -sequence newseq all
run_prog $rcvstore -sequence newseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -zero
+start_test "-zero"
mark -sequence newseq all
run_prog $rcvstore -sequence newseq -zero \
<${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -nozero
+start_test "-nozero"
mark -sequence newseq all
run_prog $rcvstore -seq newseq -zero -nozero \
<${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check that default is -public
+start_test "that default is -public"
run_prog $rcvstore -sequence pubseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
run_test 'mark -sequence pubseq -list' 'pubseq: 11'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -nopublic
+start_test "-nopublic"
run_prog $rcvstore -sequence privseq -nopublic \
<${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check -public
+start_test "-public"
run_prog $rcvstore -sequence pubseq -nopublic -public \
<${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
rm -f ${MH_TEST_DIR}/Mail/test-read-perms
# check default Msg-Protect
+start_test "default Msg-Protect"
msgprot=`mhparam msgprot`
run_prog $rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check $expected $actual 'keep first'
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
# check Msg-Protect profile entry
+start_test "Msg-Protect profile entry"
msgprot=640
printf 'Msg-Protect: %s\n' "$msgprot" >>$MH
run_prog $rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
+finish_test
exit ${failed:-0}
# check -help
+start_test "-help"
cat >"$expected" <<EOF
Usage: rcvtty [command ...]
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `$rcvtty -v` in
rcvtty\ --*) ;;
* ) printf '%s: rcvtty -v generated unexpected output\n' "$0" >&2
esac
# check normal operation. Use -biff to avoid sending notification to
+start_test "normal operation. Use -biff to avoid sending notification to"
# each of the user's terminals. So this command shouldn't do
# anything. It will write the notification(s) if the user actually
# has actually enabled biff notification, or has set the exec bit of
check "$expected" "$actual"
+finish_test
exit ${failed:-0}
run_prog folder -create +another -fast >/dev/null
# check with no options and no current message
+start_test "with no options and no current message"
run_test 'refile' 'refile: no folder specified'
# check with current message
+start_test "with current message"
run_prog folder +inbox 4 >/dev/null
run_test 'refile +other' ''
run_test 'folders -noheader' \
TOTAL = 10 messages in 3 folders.'
# check with specified message
+start_test "with specified message"
run_prog folder +inbox 5 >/dev/null
run_test 'refile 5 +other' ''
run_test 'folders -noheader' \
TOTAL = 10 messages in 3 folders.'
# check multiple messages
+start_test "multiple messages"
run_test 'refile 6 7 +other' ''
run_test 'folders -noheader' \
'another has no messages.
TOTAL = 10 messages in 3 folders.'
# check multiple folders
+start_test "multiple folders"
run_test 'refile 8 +other +another' ''
run_test 'folders -noheader' \
'another has 1 message (1- 1).
TOTAL = 11 messages in 3 folders.'
# check message number greater than highest
+start_test "message number greater than highest"
run_test 'refile 11 +other' "refile: message 11 doesn't exist"
run_prog folder -f +another >/dev/null
# check -src
+start_test "-src"
run_test 'refile 9 -src +inbox +other' ''
run_test 'folders -noheader' \
'another has 1 message (1- 1).
TOTAL = 11 messages in 3 folders.'
# check -file
+start_test "-file"
run_test "refile -file $MH_TEST_DIR/Mail/inbox/10 +other" ''
run_test 'folders -noheader' \
'another has 1 message (1-1).
TOTAL = 11 messages in 3 folders.'
# check -file -, which isn't supported
+start_test "-file -, which isn't supported"
run_test "refile -file - +other <$MH_TEST_DIR/Mail/inbox/9" \
'refile: missing argument to -file'
run_test 'folders -noheader' \
TOTAL = 11 messages in 3 folders.'
# check -draft
+start_test "-draft"
mv $MH_TEST_DIR/Mail/another/1 $MH_TEST_DIR/Mail/draft
rmdir $MH_TEST_DIR/Mail/another
run_test 'refile -draft +other' ''
fi
# check -nolink
+start_test "-nolink"
run_test 'refile 7 +other -link -nolink' ''
run_test 'folders -noheader' \
'inbox+ has 9 messages (1-10); cur=7.
run_test 'scan +inbox 7' "scan: message 7 doesn't exist"
# check -preserve
+start_test "-preserve"
run_test 'refile 10 +other -preserve' ''
run_test 'folders -noheader' \
'inbox+ has 8 messages (1- 9).
'10:Testing message 10'
# check -nopreserve
+start_test "-nopreserve"
run_test 'refile 9 -src +inbox +other -preserve -nopreserve' ''
run_test 'folders -noheader' \
'inbox+ has 7 messages (1- 8).
sbackup="`mhparam sbackup`"
# check -unlink
+start_test "-unlink"
run_test 'refile 3 -src +inbox +other -unlink' ''
run_test 'folders -noheader' \
'inbox+ has 6 messages (1- 8); cur=3.
fi
# check -nounlink
+start_test "-nounlink"
run_test 'refile 2 +other -unlink -nounlink' ''
run_test 'folders -noheader' \
'inbox+ has 5 messages (1- 8); cur=2.
fi
# test folder creation when stdin is not a tty
+start_test "folder creation when stdin is not a tty"
refile first +newfolder </dev/null
run_test 'folders -noheader' \
'inbox+ has 4 messages (4- 8).
TOTAL = 12 messages in 3 folders.'
# test -rmmproc
+start_test "-rmmproc"
run_test 'refile first +other -rmmproc echo' '4'
run_test 'folders -noheader' \
'inbox+ has 4 messages (4- 8); cur=4.
TOTAL = 13 messages in 3 folders.'
# test -normmproc
+start_test "-normmproc"
run_test 'refile first +other -rmmproc echo -normmproc' ''
run_test 'folders -noheader' \
'inbox+ has 3 messages (5- 8).
TOTAL = 13 messages in 3 folders.'
# test -retainsequences
+start_test "-retainsequences"
mark first -seq seq1
mark last -seq seq2
refile first last -retainsequences +other
# test -retainsequences when refiling to same folder (+other)
# cur is set to the original message number of the last message refiled.
+start_test "-retainsequences when refiling to same folder (+other)"
mark first -seq seq1 -zero
mark first=2 -seq seq2 -zero
refile first:2 -retainsequences +other
seq1: 18
seq2: 19"
+finish_test
exit $failed
md="$MH_TEST_DIR"/Mail/maildelivery
# check -help
+start_test "-help"
cat >"$expected" <<EOF
Usage: slocal [switches]
switches are:
check "$expected" "$actual"
# check -version
+start_test "-version"
case `$slocal -vers` in
slocal\ --*) ;;
* ) printf '%s: slocal -vers generated unexpected output\n' "$0" >&2
esac
# check unknown switch
+start_test "unknown switch"
run_test "$slocal -nonexistent" 'slocal: -nonexistent unknown'
# check non-switch argument
+start_test "non-switch argument"
run_test "$slocal nonexistent" 'slocal: only switch arguments are supported'
# If no mail spool, explicitly specify the mailbox.
[ -x /usr/bin/tee ] && tee=/usr/bin/tee || tee=tee
# check basic operation
+start_test "basic operation"
# Can't use rcvstore because slocal wipes out the environment.
# So, it would put the message in the user's inbox, not the
# test inbox. slocal also freopens stdout and stderr to
fi
# check -debug
+start_test "-debug"
run_prog $slocal -debug -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/1 \
>"$actual2" 2>&1
run_test "grep ^retrieving $actual2" 'retrieving message from stdin'
# check -verbose
+start_test "-verbose"
run_prog $slocal -verbose -maildelivery "$md" $mbox \
<"$MH_TEST_DIR"/Mail/inbox/1 >"$actual2" 2>&1
run_test "grep ^delivering $actual2" "delivering to pipe \"$tee\", success."
# check -noverbose
+start_test "-noverbose"
run_prog $slocal -verbose -noverbose -maildelivery "$md" $mbox \
<"$MH_TEST_DIR"/Mail/inbox/1 >"$actual2" 2>&1
run_test "grep ^delivering $actual2" ''
rm -f "$actual2"
# check match of From
+start_test "match of From"
cat >"$md" <<EOF
From test2@example.com qpipe A "$tee $actual"
EOF
check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
# check R and ?
+start_test "R and ?"
cat >"$md" <<EOF
From test3@example.com qpipe R "$tee $actual"
From test3@example.com qpipe ? "$tee $actual2"
check "$MH_TEST_DIR/Mail/inbox/3" "$actual2" 'keep first'
# check R and N
+start_test "R and N"
cat >"$md" <<EOF
From test4@example.com qpipe R "$tee $actual"
From test4@example.com qpipe N "$tee $actual2"
check "$MH_TEST_DIR/Mail/inbox/4" "$actual2" 'keep first'
# check default
+start_test "default"
cat >"$md" <<EOF
From test5@example.com qpipe R "$tee $actual"
default 1 qpipe A "$tee $actual2"
check "$MH_TEST_DIR/Mail/inbox/5" "$actual2" 'keep first'
# check -addr
+start_test "-addr"
cat >"$md" <<EOF
addr someaddress qpipe A "$tee $actual"
EOF
check "$MH_TEST_DIR/Mail/inbox/6" "$actual" 'keep first'
# check -addr with . in address
+start_test "-addr with . in address"
cat >"$md" <<EOF
addr "first.last" qpipe A "$tee $actual"
EOF
check "$MH_TEST_DIR/Mail/inbox/6" "$actual" 'keep first'
# check -info
+start_test "-info"
cat >"$md" <<EOF
* - qpipe A "\$(info) $actual"
EOF
check "$MH_TEST_DIR/Mail/inbox/7" "$actual" 'keep first'
# check -sender, which is compared with "source"
+start_test "-sender, which is compared with "source""
cat >"$md" <<EOF
source somesender qpipe A "$tee $actual"
EOF
check "$MH_TEST_DIR/Mail/inbox/8" "$actual" 'keep first'
# check -user
+start_test "-user"
cat >"$md" <<EOF
* - qpipe A "$tee $actual"
EOF
# that there is one.
# check -mailbox
+start_test "-mailbox"
cat >"$md" <<EOF
EOF
check "$MH_TEST_DIR/Mail/inbox/10" "$MH_TEST_DIR/Mail/inbox/11" 'keep first'
# check -file
+start_test "-file"
run_prog $slocal -mailbox "$actual" -maildelivery "$md" \
-file "$MH_TEST_DIR"/Mail/inbox/1
inc -file "$actual" -silent -truncate
check "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/inbox/11" 'keep first'
# check -suppressdup
+start_test "-suppressdup"
cat >"$md" <<EOF
* - qpipe A "$tee $actual"
EOF
fi
# check -nosuppressdup
+start_test "-nosuppressdup"
run_prog $slocal -suppress -nosuppressdup -maildelivery "$md" $mbox \
<"$MH_TEST_DIR"/Mail/inbox/2
check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
+finish_test
exit ${failed:-0}
EOF
# check -help
+start_test "-help"
# Only look at first 10 lines because the rest depend on
# whether sasl support was configured in.
cat >$expected <<EOF
check $expected $actual
# check -version
+start_test "-version"
case `whom -v` in
whom\ --*) ;;
* ) echo "$0: whom -v generated unexpected output" 1>&2
esac
# check with no options
+start_test "with no options"
run_test 'whom' ' -- Network Recipients --
user at example.com'
# check -nocheck
+start_test "-nocheck"
run_test 'whom -check -nocheck' ' -- Network Recipients --
user at example.com'
# check with file specified
+start_test "with file specified"
run_test "whom $MH_TEST_DIR/Mail/draft" ' -- Network Recipients --
user at example.com'
# check -draftmessage
+start_test "-draftmessage"
run_test "whom -draftm draft" ' -- Network Recipients --
user at example.com'
# check -draftfolder with -draftmessage
+start_test "-draftfolder with -draftmessage"
folder +drafts -create >/dev/null
folder +inbox -fast >/dev/null
cp $MH_TEST_DIR/Mail/draft $MH_TEST_DIR/Mail/drafts/1
user at example.com'
# check -draftfolder with current draftmessage
+start_test "-draftfolder with current draftmessage"
folder +drafts 1 >/dev/null
run_test "whom -draftfolder +drafts" \
' -- Network Recipients --
user at example.com'
# check -nodraftfolder
+start_test "-nodraftfolder"
run_test 'whom -draftfolder +nonexistent -nodraftfolder' \
' -- Network Recipients --
user at example.com'
# check -draft, though I'm not sure that it's useful. Note that it
+start_test "-draft, though I'm not sure that it's useful. Note that it"
# must appear after the file argument when run standalone.
run_test "whom $MH_TEST_DIR/Mail/drafts/1 -draft" \
' -- Network Recipients --
user at example.com'
# check -alias
+start_test "-alias"
rm -f $MH_TEST_DIR/Mail/draft
cat >$MH_TEST_DIR/Mail/draft <<'EOF'
From: Test1 <test1@example.com>
user1 at example.com'
# check -alias with nonexistent aliasfile
+start_test "-alias with nonexistent aliasfile"
run_test 'whom -alias nonexistent' \
"whom: aliasing error in nonexistent - unable to read 'nonexistent'"
+finish_test
exit $failed