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