X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/00db7a32b40fa2faad7c30adef98163eb5f6c64c..7540f02725475698a47046ebf4e55b3e8dea5ab6:/test/mhmail/test-mhmail diff --git a/test/mhmail/test-mhmail b/test/mhmail/test-mhmail index c773c041..c3969578 100755 --- a/test/mhmail/test-mhmail +++ b/test/mhmail/test-mhmail @@ -14,17 +14,18 @@ fi . "${srcdir}/test/post/test-post-common.sh" -# Find MIME type string, using mimetypeproc if configured with it. +# Find MIME type string, using configured procs if available. MIMETYPEPROC=`mhparam mimetypeproc` +MIMEENCODINGPROC=`mhparam mimeencodingproc` content_type_string() { - if test -z "$MIMETYPEPROC"; then + 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 - # 1) Excise leading filename followed by : and any whitespace. - # 2) Wrap charset value in double quotes. Assume that it isn't already. - printf "%s %s%s" \ - `$MIMETYPEPROC $1 | sed -e 's/.*: *//' -e 's/\(charset=\)\(.*\)/\1"\2"/'`\ - "; name=\"`basename $1`\"" + #### 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 } @@ -67,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\ --*) ;; @@ -100,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" @@ -115,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. @@ -127,6 +133,7 @@ esac # 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" @@ -147,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: @@ -304,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" <