]> diplodocus.org Git - nmh/blob - test/install-mh/test-install-mh
test-mhfixmsg: pwd(1)'s `-P' needed to avoid failure with symlinks.
[nmh] / 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_exit '-eq 1' install-mh -
20
21 # check with no options, with nmh already installed
22 run_test "install-mh" \
23 'install-mh: You already have an nmh profile, use an editor to modify it'
24
25 # check -auto, with nmh already installed
26 run_test "install-mh -auto" 'install-mh: invocation error'
27
28 # check -check, with nmh already installed
29 run_test "install-mh -check" ''
30 # make sure exit status is 0
31 run_prog install-mh -check
32 run_test "echo $?" '0'
33
34 # Remove the nmh installation so that install-mh can install.
35 rm -rf $MH_TEST_DIR/Mail
36
37 # check -check, with nmh not installed
38 run_test "install-mh -check" ''
39 # make sure exit status is 1
40 set +e
41 run_prog install-mh -check
42 run_test "echo $?" '1'
43 set -e
44
45 # check with no options, with nmh not installed. Use canned
46 # responses to install.
47 installpath=`echo $MH_TEST_DIR/Mail | sed 's%^/%%'`
48 echo "n
49 n
50 n
51 $installpath
52 y" | run_prog install-mh >/dev/null
53
54 if [ -f $MH_TEST_DIR/Mail/context -a -f "$MH" ]; then
55 run_prog install-mh -check
56 else
57 failed=`expr ${failed:-0} + 1`
58 fi
59
60 # Remove the nmh installation so that install-mh -auto can install.
61 # And set HOME to that it installs in the test directory:
62 # install-mh -auto does a chdir($HOME).
63 rm -rf $MH_TEST_DIR/Mail
64 HOME=$MH_TEST_DIR install-mh -auto >/dev/null
65
66 if [ -f $MH_TEST_DIR/Mail/context -a -f "$MH" ]; then
67 run_prog install-mh -check
68 else
69 failed=`expr ${failed:-0} + 1`
70 fi
71
72
73 exit $failed