]> diplodocus.org Git - nmh/blob - test/install-mh/test-version-check
Instead of relying on invo_name to decide whether to call
[nmh] / test / install-mh / test-version-check
1 #!/bin/sh
2 ######################################################
3 #
4 # Test display of new version welcome message. This
5 # doesn't really belong in install-mh.
6 #
7 ######################################################
8
9 set -e
10
11 if test -z "${MH_OBJ_DIR}"; then
12 srcdir=`dirname $0`/../..
13 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
14 fi
15
16 . "${MH_OBJ_DIR}/test/common.sh"
17
18 setup_test
19
20 require_prog script
21
22 actual="$MH_TEST_DIR/test-version-check$$.actual"
23 context="${MH_TEST_DIR}"/Mail/context
24
25 # Removing Version will trigger the welcome message.
26 grep -v Version "$context" > "$context.NEW"
27 mv -f "$context.NEW" "$context"
28
29
30 start_test 'mhparam skips the welcome message'
31 # The command will wait for the user to hit return. script seems to do what
32 # we want by not waiting when run in the background.
33 script -c 'mhparam path last' -f -q "$actual" >/dev/null &
34 wait $!
35 grep 'Welcome to nmh version ' "$actual" >/dev/null && false
36 rm "$actual"
37 finish_test
38
39
40 start_test 'with welcome message'
41 script -c 'pick last' -f -q "$actual" >/dev/null &
42 wait $!
43 grep 'Welcome to nmh version ' "$actual" >/dev/null
44 rm "$actual"
45 finish_test
46
47
48 start_test 'without welcome message'
49 # After running the previous test, this one should not have
50 # the welcome message.
51 script -c 'pick last' -f -q "$actual" >/dev/null &
52 wait $!
53 grep 'Welcome to nmh version ' "$actual" >/dev/null && false
54 rm "$actual"
55 finish_test
56
57
58 exit $failed