]> diplodocus.org Git - nmh/blobdiff - test/mhfixmsg/test-mhfixmsg
snprintb.c: Move interface to own file.
[nmh] / test / mhfixmsg / test-mhfixmsg
index ec384f6da18b7f7d98ad1ecaa4c8704045dc6d31..f741d9c6823f2a276f145e9087340b3570fb87ea 100755 (executable)
@@ -28,8 +28,7 @@ actual_err="$MH_TEST_DIR/test-mhfixmsg$$.actual_err"
 
 mhn_defaults="$MH_INST_DIR${nmhetcdir}/mhn.defaults"
 
 
 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
   can_reformat_texthtml=1
   if grep 'mhfixmsg-format-text/html.*w3m' "${mhn_defaults}" \
     >/dev/null; then
@@ -200,6 +199,12 @@ 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/,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
 # to solitary text/html part
 start_test "-reformat (enabled by default):  addition of text/plain part"
 # check -reformat (enabled by default):  addition of text/plain part
 # to solitary text/html part
 start_test "-reformat (enabled by default):  addition of text/plain part"
@@ -1349,27 +1354,29 @@ run_test 'mhfixmsg last -outfile '"$actual" ''
 check "$expected" "$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
 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/,21" 'keep first'
+fi
 
 
 # check -rmmproc
 
 
 # check -rmmproc
@@ -1676,7 +1683,7 @@ check "$expected" "$actual"
 start_test "input is passed through to output when there's a parse error"
 cat >"$expected.err" <<EOF
 mhfixmsg: invalid quoted-string in message 31's Content-Type: field
 start_test "input is passed through to output when there's a parse error"
 cat >"$expected.err" <<EOF
 mhfixmsg: invalid quoted-string in message 31's Content-Type: field
-          (parameter charset)
+    (parameter charset)
 mhfixmsg: unable to parse message 31
 EOF
 
 mhfixmsg: unable to parse message 31
 EOF