X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/98df2244c328b45c72cdb750f3e38889699fe020..7540f02725475698a47046ebf4e55b3e8dea5ab6:/test/mhmail/test-mhmail diff --git a/test/mhmail/test-mhmail b/test/mhmail/test-mhmail index 1caf0399..c3969578 100755 --- a/test/mhmail/test-mhmail +++ b/test/mhmail/test-mhmail @@ -14,6 +14,21 @@ fi . "${srcdir}/test/post/test-post-common.sh" +# Find MIME type string, using configured procs if available. +MIMETYPEPROC=`mhparam mimetypeproc` +MIMEENCODINGPROC=`mhparam mimeencodingproc` +content_type_string() { + if test -z "$MIMETYPEPROC" -o -z "$MIMEENCODINGPROC"; then + #### This should be the order of name and charset. + echo "text/plain; name=\"`basename $1`\"; charset=\"us-ascii\"" + else + #### Excise any leading filename followed by : and whitespace. + printf '%s; charset="%s"; name="%s"' \ + `$MIMETYPEPROC $1 | sed -e 's/.*: *//'` \ + `$MIMEENCODINGPROC $1 | sed -e 's/.*: *//'` `basename $1` + fi +} + # Customize test_post () for use with mhmail. # $1 is expected output file, provided by caller # $2 is mhmail switches, except for -body @@ -53,6 +68,7 @@ actual_err=$MH_TEST_DIR/test-mhmail$$.actual_err # check -help +start_test "-help" # Verified behavior consistent with compiled sendmail. cat >$expected <$actual 2>&1 -check $expected $actual +#### Skip nmh intro text. +mhmail -help 2>&1 | sed '/^$/,$d' >"$actual" +check "$expected" "$actual" # check -version +start_test "-version" # Verified same behavior as compiled mhmail. case `mhmail -v` in mhmail\ --*) ;; @@ -86,6 +104,7 @@ case `mhmail -v` in 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" @@ -101,6 +120,7 @@ done # 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. @@ -113,11 +133,8 @@ esac # check -nosend +start_test "-nosend" # Not supported by compiled mhmail. -#### TEMPORARY hack to diagnose failure on Solaris. -echo before -sh -x mhmail -nosend recipient@example.com -from sender1@localhost -body '' 2>&1 -echo after mhmail -nosend recipient@example.com -from sender1@localhost \ -server 127.0.0.1 -port $localport -body '' >"$actual" 2>"$actual_err" @@ -137,6 +154,7 @@ check "$expected_err" "$actual_err" # check -send +start_test "-send" # Not supported by compiled mhmail. cat > "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < DATA To: recipient@example.com From: sender8@localhost +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" Date: Message-ID: @@ -294,6 +320,7 @@ test_mhmail "$expected" '-from sender8@localhost -profile' '|' message # check repeated -from and -subject switches +start_test "repeated -from and -subject switches" # Verified same behavior as compiled mhmail. cat > "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" < "$expected" <