]> diplodocus.org Git - nmh/blobdiff - test/format/test-fmtdump
sbr/oauth.c: Remove const to avoid curl's debug_callback warning.
[nmh] / test / format / test-fmtdump
index 73fd14de19d84174583d4b752650ea71b6645e27..aebb8ed399346540d1941cca49753eb506b9a1d6 100755 (executable)
@@ -19,6 +19,29 @@ setup_test
 # Use proper program, likely not the first one on PATH.
 fmtdump="${MH_LIBEXEC_DIR}/fmtdump"
 
 # Use proper program, likely not the first one on PATH.
 fmtdump="${MH_LIBEXEC_DIR}/fmtdump"
 
+check_exit '-eq 1' "$fmtdump" -
+check_exit '-eq 1' "$fmtdump" -form
+check_exit '-eq 1' "$fmtdump" -format
+check_exit '-eq 1' "$fmtdump" foo bar
+check_exit '-eq 0' "$fmtdump" -format '
+    %4{} %(eq) %(getenv) %(decodecomp{}) %(trim{}) %(putaddr)
+    %(putlit) %(zputlit) %(compval{}) %(num)
+    %(plus) %(minus) %(multiply) %(divide) %(modulo)
+    %(charleft) %(kilo) %(kibi)
+    %(month{}) %(tzone{}) %(day{}) %(weekday{}) %(tws{}) %(pretty{})
+    %(sec{}) %(min{}) %(hour{}) %(year{}) %(yday{}) %(wday{})
+    %(clock{}) %(rclock{}) %(sday{}) %(dst{}) %(szone{})
+    %(date2local{}) %(date2gmt{})
+'
+check_exit '-eq 0' "$fmtdump" -format '
+    %(addr{}) %(pers{}) %(mbox{}) %(host{}) %(path{}) %(gname{})
+    %(note{}) %(proper{}) %(type{}) %(ingrp{}) %(nohost{})
+    %(formataddr) %(concataddr) %(getmymbox{}) %(getmyaddr{})
+    %<(null)%> %<(gt)%> %<(match)%> %<(amatch)%>
+    %(null) %(nonnull) %(ne) %(gt) %(match) %(amatch)
+'
+check_exit '-eq 0' "$fmtdump" -format "`printf '\302\010\014\015\011\177'`"
+
 expected=$MH_TEST_DIR/$$.expected
 expected_err=$MH_TEST_DIR/$$.expected_err
 actual=$MH_TEST_DIR/$$.actual
 expected=$MH_TEST_DIR/$$.expected
 expected_err=$MH_TEST_DIR/$$.expected_err
 actual=$MH_TEST_DIR/$$.actual
@@ -35,8 +58,9 @@ Usage: fmtdump [switches]
   -help
 EOF
 
   -help
 EOF
 
-$fmtdump -help >$actual 2>&1
-check $expected $actual
+#### Skip nmh intro text.
+"$fmtdump" -help | sed '/^$/,$d' >"$actual" 2>&1
+check "$expected" "$actual"
 
 # check -version
 case `$fmtdump -v` in
 
 # check -version
 case `$fmtdump -v` in