]> diplodocus.org Git - nmh/blobdiff - test/format/test-fmtdump
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[nmh] / test / format / test-fmtdump
index c7d89833e8ac7ea95e1ecfb9c342fe515653a40d..259e12a202cf9b0c5e338ecec7560bd17e2a22b7 100755 (executable)
@@ -17,7 +17,7 @@ fi
 setup_test
 
 # Use proper program, likely not the first one on PATH.
-fmtdump="${MH_LIB_DIR}/fmtdump"
+fmtdump="${MH_LIBEXEC_DIR}/fmtdump"
 
 expected=$MH_TEST_DIR/$$.expected
 expected_err=$MH_TEST_DIR/$$.expected_err
@@ -35,8 +35,9 @@ Usage: fmtdump [switches]
   -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
@@ -107,10 +108,69 @@ L10:      CHAR '\n'
 EOF
 
 run_prog $fmtdump >$actual 2>&1
-check $expected $actual 'keep first'
+check $expected $actual
 
 # check -form
-run_prog $fmtdump -form "$MH_TEST_DIR/Mail/scan.default" >$actual 2>&1
+cat >$expected <<EOF
+       LV_DAT, value dat[0]
+       NUMF, width 4, fill ' '
+       LV_DAT, value dat[1]
+       IF_V_NE 0 continue else goto L0
+       CHAR '+'
+       GOTO L1
+L0:    CHAR ' '
+L1:    LS_COMP, comp "replied"
+       IF_S continue else goto L2
+       CHAR '-'
+       GOTO L3
+L2:    LS_COMP, comp "encrypted"
+       IF_S continue else goto L4
+       CHAR 'E'
+L3:    GOTO L5
+L4:    CHAR ' '
+L5:    PARSEDATE, c_name "date", c_type <DATE>
+       LV_MON, c_name "date", c_type <DATE>
+       NUMF, width 2, fill '0'
+       CHAR '/'
+       PARSEDATE, c_name "date", c_type <DATE>
+       LV_MDAY, c_name "date", c_type <DATE>
+       NUMF, width 2, fill '0'
+       LS_COMP, comp "date", c_type <DATE>
+       IF_S continue else goto L6
+       CHAR ' '
+       GOTO L7
+L6:    CHAR '*'
+L7:    MYMBOX, c_name "from", c_type <ADDR>
+       LV_COMPFLAG, comp "from", c_type <ADDR>
+       IF_V_NE 0 continue else goto L8
+       LS_COMP, comp "to", c_type <ADDR>
+       IF_S continue else goto L8
+       LIT "To:"
+       PARSEADDR, c_name "to", c_type <ADDR>
+       LS_FRIENDLY, c_name "to", c_type <ADDR>
+       FT_LS_DECODE
+       
+       STRF, width 14, fill ' '
+L8:    IF_V_EQ 0 continue else goto L9
+       PARSEADDR, c_name "from", c_type <ADDR>
+       LS_FRIENDLY, c_name "from", c_type <ADDR>
+       FT_LS_DECODE
+       
+       STRF, width 17, fill ' '
+L9:    LIT "  "
+       LS_COMP, comp "subject"
+       FT_LS_DECODE
+       STR
+       LS_COMP, comp "body"
+       IF_S continue else goto L10
+       LIT "<<"
+       COMP, comp "body"
+       LIT ">>"
+L10:   CHAR '\n'
+       DONE
+EOF
+
+run_prog $fmtdump -form "$MH_INST_DIR${nmhetcdir}/scan.default" >$actual 2>&1
 check $expected $actual
 
 # check -format