2 ######################################################
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname $0`/../..
12 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 . "$MH_OBJ_DIR/test/common.sh"
19 # Use proper program, likely not the first one on PATH.
20 fmtdump="${MH_LIB_DIR}/fmtdump"
22 expected=$MH_TEST_DIR/$$.expected
23 expected_err=$MH_TEST_DIR/$$.expected_err
24 actual=$MH_TEST_DIR/$$.actual
25 actual_err=$MH_TEST_DIR/$$.actual_err
30 Usage: fmtdump [switches]
38 $fmtdump -help >$actual 2>&1
39 check $expected $actual
44 * ) printf '%s: fmtdump -v generated unexpected output\n' "$0" >&2
45 failed=`expr ${failed:-0} + 1`;;
48 # check unknown switch
49 run_test "$fmtdump -nonexistent" 'fmtdump: -nonexistent unknown'
51 # check with no switches
54 NUMF, width 4, fill ' '
56 IF_V_NE 0 continue else goto L0
60 L1: LS_COMP, comp "replied"
61 IF_S continue else goto L2
64 L2: LS_COMP, comp "encrypted"
65 IF_S continue else goto L4
69 L5: PARSEDATE, c_name "date", c_type <DATE>
70 LV_MON, c_name "date", c_type <DATE>
71 NUMF, width 2, fill '0'
73 PARSEDATE, c_name "date", c_type <DATE>
74 LV_MDAY, c_name "date", c_type <DATE>
75 NUMF, width 2, fill '0'
76 LS_COMP, comp "date", c_type <DATE>
77 IF_S continue else goto L6
81 L7: MYMBOX, c_name "from", c_type <ADDR>
82 LV_COMPFLAG, comp "from", c_type <ADDR>
83 IF_V_NE 0 continue else goto L8
84 LS_COMP, comp "to", c_type <ADDR>
85 IF_S continue else goto L8
87 PARSEADDR, c_name "to", c_type <ADDR>
88 LS_FRIENDLY, c_name "to", c_type <ADDR>
90 STRF, width 14, fill ' '
91 L8: IF_V_EQ 0 continue else goto L9
92 PARSEADDR, c_name "from", c_type <ADDR>
93 LS_FRIENDLY, c_name "from", c_type <ADDR>
95 STRF, width 17, fill ' '
97 LS_COMP, comp "subject"
101 IF_S continue else goto L10
109 $fmtdump >$actual 2>&1
110 check $expected $actual 'keep first'
113 $fmtdump -form "$MH_TEST_DIR/Mail/scan.default" >$actual 2>&1
114 check $expected $actual
118 LS_LIT str "1234567890"
119 IF_S continue else goto L0
125 $fmtdump -format '%<(lit 1234567890)%(strlen)%>' >$actual 2>&1
126 check $expected $actual