X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/3f609815e33ab5474e631eac097d515d982ff0f5..2e04b8ea0e57e411665aa6a8814ff65db0d4cd2b:/test/mhfixmsg/test-mhfixmsg?ds=inline diff --git a/test/mhfixmsg/test-mhfixmsg b/test/mhfixmsg/test-mhfixmsg index f7f47b90..2194c7a2 100755 --- a/test/mhfixmsg/test-mhfixmsg +++ b/test/mhfixmsg/test-mhfixmsg @@ -51,6 +51,8 @@ Usage: mhfixmsg [+folder] [msgs] [switches] switches are: -decodetext 8bit|7bit -nodecodetext + -decodetypes + -[no]crlflinebreaks -[no]textcharset -[no]reformat -[no]replacetextplain @@ -418,11 +420,11 @@ else fi -# check -decode (enabled by default) +# check -decodetext (enabled by default) cat >"$expected" <`mhpath new` <$expected <`mhpath new` <$expected <`mhpath new` <`mhpath new` < +To: +Subject: mhfixmsg bad boundary test + +This is a multi-part message in MIME format. + +------=_ NextPart_000_1781A1A_01CC1147.81EBA8D4 +Content-Type: text/plain + +The boundary below doesn't match the header boundary. + +------=_ +NextPart_000_1781A1A_01CC1147.81EBA8D4-- +EOF + +cp -p `mhpath last` "$expected" +run_test "mhfixmsg last -outfile $actual" '' +check "$expected" "$actual" + + # check that text/plain part is not added to text/html in multipart/related # when it shouldn't be cat >`mhpath new` <"$expected" <`mhpath new` <<'EOF' @@ -989,6 +1108,33 @@ run_prog mhfixmsg last -outfile "$actual" check "$expected" "$actual" +# check stripping of CRs from ASCII text context +cat >"$expected" <`mhpath new` <<'EOF' +MIME-Version: 1.0 +From: sender@example.com +To: recipient@example.com +Subject: message with CR's +Date: Mon, 29 Apr 2013 11:51:45 -0400 + +There were two CR-LF pairs at the end of this sentence. + +EOF + +run_prog mhfixmsg last -outfile "$actual" -nocrlflinebreaks +check "$expected" "$actual" + + # check -replacetextplain prepare_space >"$expected" <$expected < + + This was the text/html part. + + + + +------- =_aaaaaaaaaa0-- +EOF + +cat >`mhpath new` <$expected <`mhpath new` <$expected <`mhpath new` <$expected <`mhpath new` <"$expected.err" <`mhpath new` <"$actual.err" +set -e +#### Expected output is identical to the input message. +check `mhpath last` "$actual" 'keep first' +check "$expected.err" "$actual.err" + + +# check that input is passed through to output when there's a parse error +# (the charset string is missing its closing quote) with -outfile, and +# input from stdin. Don't check err output, because it contains the name +# of a tmp file. It's similar to that of the previous check. +set +e +run_prog mhfixmsg -file - -outfile - <`mhpath last` >"$actual" 2>/dev/null +set -e +#### Expected output is identical to the input message. +check `mhpath last` "$actual" + + # make sure there are no tmp files left over find "$MH_TEST_DIR/Mail" \( -name 'mhfix*' -o -name ',mhfix*' \) -print \ >"$actual"