Updated scan.highlighted to feed an expression to %(zputlit).
[mmh] / test / install-mh / test-install-mh
1 #!/bin/sh
2 ######################################################
3 #
4 # Test install-mh
5 #
6 ######################################################
7
8 set -e
9
10 if test -z "${MH_OBJ_DIR}"; then
11     srcdir=`dirname $0`/../..
12     MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
13 fi
14
15 . "$MH_OBJ_DIR/test/common.sh"
16
17 setup_test
18
19 # check with no options, with nmh already installed
20 run_test "install-mh" \
21     'install-mh: You already have an nmh profile, use an editor to modify it'
22
23 # check -auto, with nmh already installed
24 run_test "install-mh -auto" 'install-mh: invocation error'
25
26 # check -check, with nmh already installed
27 run_test "install-mh -check" ''
28 # make sure exit status is 0
29 install-mh -check
30 run_test "echo $?" '0'
31
32 # Remove the nmh installation so that install-mh can install.
33 rm -rf $MH_TEST_DIR/Mail
34
35 # check -check, with nmh not installed
36 run_test "install-mh -check" ''
37 # make sure exit status is 1
38 set +e
39 install-mh -check
40 run_test "echo $?" '1'
41 set -e
42
43 # check with no options, with nmh not installed.  Use canned
44 # responses to install.
45 installpath=`echo $MH_TEST_DIR/Mail | sed 's%^/%%'`
46 echo "n
47 n
48 n
49 $installpath
50 y" | install-mh >/dev/null
51
52 if [ -f $MH_TEST_DIR/Mail/context  -a  -f $MH_TEST_DIR/Mail/.mh_profile ]; then
53   install-mh -check
54 else
55   failed=`expr ${failed:-0} + 1`
56 fi
57
58 # Remove the nmh installation so that install-mh -auto can install.
59 # And set HOME to that it installs in the test directory:
60 # install-mh -auto does a chdir($HOME).
61 rm -rf $MH_TEST_DIR/Mail
62 HOME=$MH_TEST_DIR install-mh -auto >/dev/null
63
64 if [ -f $MH_TEST_DIR/Mail/context  -a  -f $MH_TEST_DIR/Mail/.mh_profile ]; then
65   install-mh -check
66 else
67   failed=`expr ${failed:-0} + 1`
68 fi
69
70
71 exit $failed