]> diplodocus.org Git - nmh/blobdiff - test/post/test-mhmail
Replaced mhmail -debug switch with -nosend, and added -send.
[nmh] / test / post / test-mhmail
index 08df5577fb2c0f4e9c21f2bac624e6b038b284f7..ce4d9c6bd1b59afd4f4a6c5f1d79458084f84f4c 100755 (executable)
@@ -56,6 +56,7 @@ test_mhmail ()
     #
 
     sed -e 's/^Date:.*/Date:/' \
+        -e 's/^Resent-Date:.*/Resent-Date:/' \
         -e 's/^Message-ID:.*/Message-ID:/' "$actual" > "$actual".nodate
     rm -f "$actual"
 
@@ -76,11 +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
 
@@ -109,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
@@ -133,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
@@ -578,4 +599,35 @@ test_mhmail "$expected" "-from sender@localhost" -b "here's some text
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
+# check -resent
+# Verified same behavior as compiled mhmail.
+cat > "$expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<recipient@example.com>
+RCPT TO:<recipient@example.com>
+DATA
+Resent-To: recipient@example.com
+Resent-From: recipient@example.com
+To: recipient@example.com
+From: sender@localhost
+Date:
+Resent-Date:
+
+please resend this message
+
+.
+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
+"
+
+[ ${failed:-0} -eq 0 ] || exit ${failed:-0}
+
+
 exit ${failed:-0}