]>
diplodocus.org Git - nmh/blob - test/mhparam/test-mhparam
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 check_exit
'-eq 1' mhparam
-
20 check_exit
'-eq 0' mhparam localmbox
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
31 Usage: mhparam [profile-components] [switches]
40 #### Skip nmh intro text.
41 mhparam
-help | sed '/^$/,$d' >"$actual" 2>&1
42 check
"$expected" "$actual"
48 * ) echo "$0: mhparam -v generated unexpected output" 1>&2
49 failed
=`expr ${failed:-0} + 1`;;
52 # check unknown option
53 start_test
"unknown option"
54 run_test
'mhparam -nonexistent' 'mhparam: -nonexistent unknown'
59 # -all adds current folder and Version
60 echo 'Current-Folder: '`folder -f` >>$expected
61 echo "Version: nmh-$MH_VERSION" >>$expected
62 run_prog mhparam
-all >$actual
63 check
$expected $actual 'keep first'
65 # check -all with a component
66 start_test
"-all with a component"
67 echo 'mhparam: profile-components ignored with -all' >$expected_err
68 run_prog mhparam
-all path
>$actual 2>$actual_err
69 check
$expected $actual 'keep first'
70 check
$expected_err $actual_err
72 # check -all with -components
73 start_test
"-all with -components"
74 echo 'mhparam: -components ignored with -all' >$expected_err
75 run_prog mhparam
-all -components >$actual 2>$actual_err
76 check
$expected $actual
77 check
$expected_err $actual_err
80 start_test
"one component"
81 run_test
'mhparam path' "$MH_TEST_DIR/Mail"
83 # check more than one component, which enables -component
84 start_test
"more than one component, which enables -component"
85 echo 'AliasFile: aliases' >>"$MH"
86 run_test
'mhparam path AliasFile' "path: $MH_TEST_DIR/Mail
89 # check each component in procs array in uip/mhparam.c
90 start_test
"each component in procs array in uip/mhparam.c"
91 # The tests don't override these, so they're default or configured values.
92 # Note that cat is hardcoded here because the testsuite uses it for moreproc.
96 $MH_INST_DIR$bindir/mhbuild
97 $MH_INST_DIR$bindir/refile
101 $MH_INST_DIR$bindir/mhmail
102 $MH_INST_DIR$nmhlibexecdir/mhl
106 $MH_INST_DIR$nmhlibexecdir/post
107 $MH_INST_DIR$bindir/send
108 $MH_INST_DIR$bindir/mhshow
109 $MH_INST_DIR$nmhlibexecdir/mhl
111 $MH_INST_DIR$bindir/whatnow
112 $MH_INST_DIR$bindir/whom
119 run_prog mhparam
-nocomponent \
142 spoollocking
>$actual 2>&1
144 check
$expected $actual
146 #### This exits with non-zero status, so let run_test squash that:
147 run_test
'mhparam formatproc rmmproc' ''
149 #### Test sbackup separately because it's only passed as a -D compile option.
150 case `mhparam sbackup` in
152 * ) echo mhparam sbackup failed
153 failed
=`expr ${failed:-0} + 1` ;;
157 start_test
"-component"
158 run_test
'mhparam -component Path' "Path: $MH_TEST_DIR/Mail"
160 # check -component, note that component name of argument is echoed exactly
161 start_test
"-component, note that component name of argument is echoed exactly"
162 run_test
'mhparam -component path' "path: $MH_TEST_DIR/Mail"
163 run_test
'mhparam -component PATH' "PATH: $MH_TEST_DIR/Mail"
166 start_test
"-nocomponent"
167 run_test
'mhparam -component -nocomponent path' "$MH_TEST_DIR/Mail"
168 run_test
'mhparam -nocomponent path AliasFile' "$MH_TEST_DIR/Mail
171 # check nonexistent component
172 start_test
"nonexistent component"
173 run_test
'mhparam nonexistent' ''
175 # check that exit status notes nonexistent components
176 start_test
"exit status notes nonexistent components"
177 for c
in 'missing' 'path missing' 'missing path' 'missing missing'; do
179 mhparam
$c >/dev
/null
187 # Some of its output depends on configure options, so don't bother to
188 # check for correctness here.
189 mhparam
-debug >/dev
/null
191 # check with text file that does not end with newline
192 start_test
"with text file that does not end with newline"
193 printf 'Editor: emacs' >>"$MH"
194 run_test
'mhparam -nocomponent editor' 'emacs'