X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/513587ec31160434400bb003d7160777e2db6bb6..79f012b76eba04d50a36a4a37c57458a8d521434:/test/mhfixmsg/test-mhfixmsg?ds=inline diff --git a/test/mhfixmsg/test-mhfixmsg b/test/mhfixmsg/test-mhfixmsg index 77de37da..2194c7a2 100755 --- a/test/mhfixmsg/test-mhfixmsg +++ b/test/mhfixmsg/test-mhfixmsg @@ -887,6 +887,33 @@ run_test 'mhfixmsg last -outfile '"$actual"' -verbose' \ check "$expected" "$actual" +# check that message is not modified when -fixboundary fails +cat >`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` < - This is the text/html part. + This was the text/html part. @@ -1376,16 +1403,16 @@ Content-Transfer-Encoding: quoted-printable This is the text/plain part. ------- =_aaaaaaaaaa0 -Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt" +Content-Type: text/html; charset="iso-8859-1"; name="test2.txt" Content-Disposition: attachment; filename="test2.txt" Content-Transfer-Encoding: base64 -PGh0bWw+CjxoZWFkPgogICAgVGhpcyBpcyB0aGUgdGV4dC9odG1sIHBhcnQuCjwvaGVhZD4KPC9i -b2R5Pgo8L2h0bWw+Cg== +PGh0bWw+CjxoZWFkPgogICAgVGhpcyB3YXMgdGhlIHRleHQvaHRtbCBwYXJ0Lgo8L2hlYWQ+Cjwv +Ym9keT4KPC9odG1sPgo= ------- =_aaaaaaaaaa0-- EOF -run_prog mhfixmsg last -outfile "$actual" +run_prog mhfixmsg last -outfile "$actual" -noreformat check "$expected" "$actual" @@ -1406,15 +1433,32 @@ Content-Transfer-Encoding: 8bit This is the text/plain part. ------- =_aaaaaaaaaa0 -Content-Type: multipart/alternative; boundary="----=_nmh-multipart2" +Content-Type: text/html; charset="iso-8859-1"; name="test2.txt" +Content-Disposition: attachment; filename="test2.txt" +Content-Transfer-Encoding: base64 -------=_nmh-multipart2 -Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt" -Content-Transfer-Encoding: 8bit +PGh0bWw+DQo8aGVhZD4NCiAgICBUaGlzIGlzIHRoZSB0ZXh0L2h0bWwgcGFydC4NCjwvaGVhZD4N +CjwvYm9keT4NCjwvaHRtbD4NCg== + +------- =_aaaaaaaaaa0-- +EOF + +cat >`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"