]> diplodocus.org Git - nmh/blobdiff - test/post/test-mhmail
Added Jerrad Pierce's suggestion to use -editor prompter.
[nmh] / test / post / test-mhmail
index 17c950541540c0f47461923a4a6ba68199b7a34c..0d0943e1a07df6ed6845390581bd66dcd8f60958 100755 (executable)
@@ -77,12 +77,13 @@ Usage: mhmail [addrs ... [switches]]
   -b(ody) text
   -c(c) addrs ...
   -f(rom) addr
-  -s(ubject) text
+  -su(bject) text
   -r(esent)
   -pr(ofile)
+  -se(nd)
+  -nose(nd)
   -v(ersion)
   -h(elp)
-  -d(ebug)
   and all post(8)/send(1) switches
 EOF
 
@@ -111,20 +112,18 @@ case `mhmail` in
 esac
 
 
-# check -debug
+# check -nosend
 # Not supported by compiled mhmail.
-mhmail -debug recipient@example.com -from sender@localhost \
+mhmail -nosend recipient@example.com -from sender@localhost \
   -server 127.0.0.1 -port $localport -body '' >"$actual" 2>"$actual_err"
 
 tmpfil=`head -1 $actual | sed -e 's/://'`
 
 cat > "$expected" <<EOF
-${tmpfil}:
 To: recipient@example.com
 From: sender@localhost
 
 
-$MH_INST_DIR$auxexecdir/post ${tmpfil} -server 127.0.0.1 -port $localport
 EOF
 
 cat > "$expected_err" <<EOF
@@ -135,6 +134,26 @@ check "$expected_err" "$actual_err"
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
+# check -send
+# Not supported by compiled mhmail.
+cat > "$expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<sender@localhost>
+RCPT TO:<recipient@example.com>
+DATA
+To: recipient@example.com
+From: sender@localhost
+Date:
+
+message
+.
+QUIT
+EOF
+
+test_mhmail "$expected" "-from sender@localhost -nosend -send" '|' message
+[ ${failed:-0} -eq 0 ] || exit ${failed:-0}
+
+
 # check -from
 # Verified same behavior as compiled mhmail.
 cat > "$expected" <<EOF
@@ -220,7 +239,8 @@ QUIT
 EOF
 
 test_mhmail "$expected" \
-    "-from sender@localhost -cc recipient2@example.com recipient3@example.com recipient4@example.com" '|' message
+    '-from sender@localhost -cc recipient2@example.com recipient3@example.com '\
+'recipient4@example.com' '|' message
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
@@ -241,8 +261,7 @@ message
 QUIT
 EOF
 
-test_mhmail "$expected" \
-  "-from sender@localhost -subject Test" '|' message
+test_mhmail "$expected" '-from sender@localhost -subject Test' '|' message
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
@@ -268,8 +287,7 @@ message
 QUIT
 EOF
 
-test_mhmail "$expected" \
-  "-from sender@localhost -profile" '|' message
+test_mhmail "$expected" '-from sender@localhost -profile' '|' message
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
@@ -290,8 +308,8 @@ message
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost -from sender2@localhost \
--subject Subject1 -subject Subject2" -b message
+test_mhmail "$expected" '-from sender@localhost -from sender2@localhost '\
+'-subject Subject1 -subject Subject2' -b message
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 # check repeated -body arguments
@@ -333,8 +351,8 @@ message
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost \
--cc cc1@example.com -cc cc2@example.com" -b message
+test_mhmail "$expected" \
+  '-from sender@localhost -cc cc1@example.com -cc cc2@example.com' -b message
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
@@ -358,8 +376,9 @@ message
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost \
--cc cc1@example.com -subject Test cc2@example.com" -b message
+test_mhmail "$expected" \
+  '-from sender@localhost -cc cc1@example.com -subject Test cc2@example.com' \
+  -b message
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
@@ -398,7 +417,7 @@ Date:
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost" '|' '\n'
+test_mhmail "$expected" '-from sender@localhost' '|' '\n'
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
@@ -420,7 +439,7 @@ Date:
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost" '|' '\n\n\n'
+test_mhmail "$expected" '-from sender@localhost' '|' '\n\n\n'
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
@@ -440,7 +459,7 @@ no newline in input
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost" '|' 'no newline in input'
+test_mhmail "$expected" '-from sender@localhost' '|' 'no newline in input'
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
@@ -462,7 +481,7 @@ here's some text
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost" '|' "here's some text\n\n\n"
+test_mhmail "$expected" '-from sender@localhost' '|' "here's some text\n\n\n"
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
@@ -482,7 +501,7 @@ Date:
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost" -b ''
+test_mhmail "$expected" '-from sender@localhost' -b ''
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
@@ -503,7 +522,7 @@ Date:
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost" -b '
+test_mhmail "$expected" '-from sender@localhost' -b '
 '
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
@@ -528,7 +547,7 @@ Date:
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost" -b '
+test_mhmail "$expected" '-from sender@localhost' -b '
 
 
 '
@@ -551,7 +570,7 @@ no newline in input
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost" -b 'no newline in input'
+test_mhmail "$expected" '-from sender@localhost' -b 'no newline in input'
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
@@ -574,7 +593,7 @@ here's some text
 QUIT
 EOF
 
-test_mhmail "$expected" "-from sender@localhost" -b "here's some text
+test_mhmail "$expected" '-from sender@localhost' -b "here's some text
 
 "
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
@@ -594,19 +613,76 @@ From: sender@localhost
 Date:
 Resent-Date:
 
-please resend this message
+please resend this message, #1
+.
+QUIT
+EOF
+
+test_mhmail "$expected" '-from recipient@example.com -resent' \
+  -b 'To: recipient@example.com
+From: sender@localhost
+Date: Sat Jun 16 18:35:15 -0500
+
+please resend this message, #1'
 
+[ ${failed:-0} -eq 0 ] || exit ${failed:-0}
+
+# check -resent -profile, using stdin
+# Not supported by compiled mhmail.
+cat > "$expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<recipient@example.com>
+RCPT TO:<recipient@example.com>
+DATA
+To: recipient@example.com
+From: sender@localhost
+Date:
+Resent-To: recipient@example.com
+Resent-From: recipient@example.com
+Resent-Date:
+
+please resend this message, #2
 .
 QUIT
 EOF
 
-test_mhmail "$expected" "-from recipient@example.com -resent" \
-  -b "To: recipient@example.com
+test_mhmail "$expected" \
+  '-from recipient@example.com -resent -profile -nomsgid' \
+  '|' 'To: recipient@example.com
 From: sender@localhost
 Date: Sat Jun 16 18:35:15 -0500
 
-please resend this message
-"
+please resend this message, #2'
+
+[ ${failed:-0} -eq 0 ] || exit ${failed:-0}
+
+
+# check -resent -profile, using -b
+# Not supported by compiled mhmail.
+cat > "$expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<recipient@example.com>
+RCPT TO:<recipient@example.com>
+DATA
+To: recipient@example.com
+From: sender@localhost
+Date:
+Resent-To: recipient@example.com
+Resent-From: recipient@example.com
+Resent-Date:
+
+please resend this message, #3
+.
+QUIT
+EOF
+
+test_mhmail "$expected" \
+  '-from recipient@example.com -resent -profile -nomsgid' \
+  -b 'To: recipient@example.com
+From: sender@localhost
+Date: Sat Jun 16 18:35:15 -0500
+
+please resend this message, #3'
 
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}