X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/451ea84e6493e11141129c4cf5d8e0f01d0f7c7d..6567362ad831e08b8314297cf12bb732e8eb20c7:/test/mhfixmsg/test-mhfixmsg?ds=sidebyside diff --git a/test/mhfixmsg/test-mhfixmsg b/test/mhfixmsg/test-mhfixmsg index ec384f6d..138c5051 100755 --- a/test/mhfixmsg/test-mhfixmsg +++ b/test/mhfixmsg/test-mhfixmsg @@ -28,8 +28,7 @@ actual_err="$MH_TEST_DIR/test-mhfixmsg$$.actual_err" mhn_defaults="$MH_INST_DIR${nmhetcdir}/mhn.defaults" -if grep mhfixmsg-format-text/html "${mhn_defaults}" \ - >/dev/null; then +if grep mhfixmsg-format-text/html "${mhn_defaults}" >/dev/null; then can_reformat_texthtml=1 if grep 'mhfixmsg-format-text/html.*w3m' "${mhn_defaults}" \ >/dev/null; then @@ -54,6 +53,8 @@ Usage: mhfixmsg [+folder] [msgs] [switches] -decodetext 8bit|7bit|binary -nodecodetext -decodetypes + -decodeheaderfieldbodies utf-8 + -nodecodeheaderfieldbodies -[no]crlflinebreaks -[no]textcharset -[no]reformat @@ -72,7 +73,7 @@ Usage: mhfixmsg [+folder] [msgs] [switches] EOF #### Skip nmh intro text. -run_prog mhfixmsg -help | sed '/^$/,$d' >"$actual" 2>&1 +run_prog mhfixmsg -help 2>&1 | sed '/^$/,$d' >"$actual" check "$expected" "$actual" @@ -180,6 +181,7 @@ run_test 'mhfixmsg last -outfile '"$actual"' -verbose' \ QUOTED-PRINTABLE with 8 bit" check "$expected" "$actual" 'keep first' +sbackup="`mhparam sbackup`" # check with no options: checks backup start_test "with no options: checks backup" @@ -188,7 +190,7 @@ folder last >/dev/null run_test 'mhfixmsg' '' check "$expected" "$MH_TEST_DIR"/Mail/inbox/11 'keep first' cp "$MH_TEST_DIR"/Mail/inbox/11.original "$MH_TEST_DIR"/Mail/inbox/11 -check "$MH_TEST_DIR"/Mail/inbox/,11 "$MH_TEST_DIR"/Mail/inbox/11.original +check "$MH_TEST_DIR/Mail/inbox/${sbackup}11" "$MH_TEST_DIR"/Mail/inbox/11.original # check backup with -file @@ -197,7 +199,13 @@ cp "$MH_TEST_DIR"/Mail/inbox/11 "$MH_TEST_DIR"/Mail/inbox/11.original folder last >/dev/null run_test 'mhfixmsg -file '"$MH_TEST_DIR"/Mail/inbox/11 '' check "$MH_TEST_DIR"/Mail/inbox/11 "$expected" 'keep first' -check "$MH_TEST_DIR"/Mail/inbox/,11 "$MH_TEST_DIR"/Mail/inbox/11.original +check "$MH_TEST_DIR/Mail/inbox/${sbackup}11" "$MH_TEST_DIR"/Mail/inbox/11.original + + +# check -file with directory +start_test "-file with directory" +run_test 'mhfixmsg -file /tmp' 'mhfixmsg: /tmp is a directory +mhfixmsg: unable to parse message from file /tmp' # check -reformat (enabled by default): addition of text/plain part @@ -358,8 +366,8 @@ else fi -# check -nodecode -start_test "-nodecode" +# check -nodecodetext +start_test "-nodecodetext" prepare_space >"$expected" <"$expected.err" #### lynx inserts multiple blank lines, so squeeze them. - run_prog mhfixmsg last -nodecode -outfile - -verbose 2>"$actual.err" | \ + run_prog mhfixmsg last -nodecodetext -outfile - -verbose 2>"$actual.err" | \ squeeze_lines >"$actual" check "$expected" "$actual" 'ignore space' check "$expected.err" "$actual.err" @@ -1349,27 +1357,29 @@ run_test 'mhfixmsg last -outfile '"$actual" '' check "$expected" "$actual" -# check rmmproc -start_test "rmmproc" -cat >"$MH_TEST_DIR/Mail/rmmproc" <<'EOF' +if [ $can_reformat_texthtml -eq 1 ]; then + # check rmmproc + start_test "rmmproc" + cat >"$MH_TEST_DIR/Mail/rmmproc" <<'EOF' mv "$1" "$1.backup" EOF -chmod a+x "${MH_TEST_DIR}/Mail/rmmproc" -echo "rmmproc: ${MH_TEST_DIR}/Mail/rmmproc" >>"$MH" -cp "${MH_TEST_DIR}/Mail/inbox/16" "${MH_TEST_DIR}/Mail/inbox/16.original" + chmod a+x "${MH_TEST_DIR}/Mail/rmmproc" + echo "rmmproc: ${MH_TEST_DIR}/Mail/rmmproc" >>"$MH" + cp "${MH_TEST_DIR}/Mail/inbox/16" "${MH_TEST_DIR}/Mail/inbox/16.original" -run_test 'mhfixmsg 16' '' -check "${MH_TEST_DIR}/Mail/inbox/16.backup" \ - "${MH_TEST_DIR}/Mail/inbox/16.original" + run_test 'mhfixmsg 16' '' + check "${MH_TEST_DIR}/Mail/inbox/16.backup" \ + "${MH_TEST_DIR}/Mail/inbox/16.original" -# check -normmproc -start_test "-normmproc" -cp "${MH_TEST_DIR}/Mail/inbox/21" "${MH_TEST_DIR}/Mail/inbox/22" + # check -normmproc + start_test "-normmproc" + cp "${MH_TEST_DIR}/Mail/inbox/21" "${MH_TEST_DIR}/Mail/inbox/22" -run_test 'mhfixmsg 21 -normmproc' -check "${MH_TEST_DIR}/Mail/inbox/22" \ - "${MH_TEST_DIR}/Mail/inbox/,21" 'keep first' + run_test 'mhfixmsg 21 -normmproc' + check "${MH_TEST_DIR}/Mail/inbox/22" \ + "${MH_TEST_DIR}/Mail/inbox/${sbackup}21" 'keep first' +fi # check -rmmproc @@ -1676,7 +1686,7 @@ check "$expected" "$actual" start_test "input is passed through to output when there's a parse error" cat >"$expected.err" <"$actual" 2>/dev/null set -e @@ -1782,13 +1792,75 @@ run_prog mhfixmsg -file - -outfile - <`mhpath last` >"$actual" 2>/dev/null check "$expected" "$actual" +start_test "-nodecodeheaderfieldbodies" +cat >"`mhpath new`" <"$actual" 2>/dev/null +check `mhpath last` "$actual" 'keep first' + + +start_test "test decoding of UTF-8 header value" +cat >"$expected" <"$actual" 2>/dev/null +check "$expected" "$actual" + + # make sure there are no tmp files left over -find "$MH_TEST_DIR/Mail" \( -name 'mhfix*' -o -name ',mhfix*' \) -print \ +find "$MH_TEST_DIR/Mail" -name '*mhfix*' -print \ >"$actual" cat >"$expected" <