]>
diplodocus.org Git - nmh/blob - test/install-mh/test-version-check
2 ######################################################
4 # Test display of new version welcome message. This
5 # doesn't really belong in install-mh.
7 ######################################################
11 if test -z "${MH_OBJ_DIR}"; then
12 srcdir
=`dirname $0`/..
/..
13 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
16 .
"${MH_OBJ_DIR}/test/common.sh"
22 actual
="$MH_TEST_DIR/test-version-check$$.actual"
23 context
="${MH_TEST_DIR}"/Mail
/context
24 version
="Version: nmh-${MH_VERSION}"
26 # Removing Version will trigger the welcome message. (setup_test
27 # inserted it so that other tests wouldn't show it.)
28 grep -v Version
"$context" > "$context.NEW"
29 mv -f "$context.NEW" "$context"
32 start_test
'mhparam skips the welcome message'
33 # The command will wait for the user to hit return. script seems to do what
34 # we want by not waiting when run in the background.
35 script -c 'mhparam path last' -f -q "$actual" >/dev
/null
&
37 grep 'Welcome to nmh version ' "$actual" >/dev
/null
&& false
39 # Make sure that version wasn't added to context.
40 grep "^${version}$" "${MH_TEST_DIR}/Mail/context" >/dev
/null
&& false
44 start_test
'Welcome: disable in profile skips the welcome message'
45 cp "${MH}" "${MH}-welcome"
46 printf 'Welcome: disable\n' >> "${MH}-welcome"
47 MH
="${MH}-welcome" script -c 'pick last' -f -q "$actual" >/dev
/null
&
49 grep 'Welcome to nmh version ' "$actual" >/dev
/null
&& false
51 # Make sure that version wasn't added to context.
52 grep "^${version}$" "${MH_TEST_DIR}/Mail/context" >/dev
/null
&& false
56 start_test
'with welcome message'
57 script -c 'pick last' -f -q "$actual" >/dev
/null
&
59 grep 'Welcome to nmh version ' "$actual" >/dev
/null
61 # Make sure that version was added to context.
62 grep "^${version}$" "${MH_TEST_DIR}/Mail/context" >/dev
/null
66 start_test
'without welcome message'
67 # After running the previous test, this one should not have
68 # the welcome message.
69 script -c 'pick last' -f -q "$actual" >/dev
/null
&
71 grep 'Welcome to nmh version ' "$actual" >/dev
/null
&& false
73 # Make sure that version is still in context.
74 grep "^${version}$" "${MH_TEST_DIR}/Mail/context" >/dev
/null
78 start_test
'with MHCONTEXT, welcome only if older'
79 MHCONTEXT
="${MH_TEST_DIR}/Mail/context2"; export MHCONTEXT
80 printf 'Version: nmh-1.5\n' >"${MHCONTEXT}"
81 script -c 'pick last' -f -q "$actual" >/dev
/null
&
83 grep 'Welcome to nmh version ' "$actual" >/dev
/null
84 # And make sure that version did get updated in context.
85 grep "^${version}$" "${MHCONTEXT}" >/dev
/null
90 start_test
"with MHCONTEXT doesn't welcome if newer"
91 printf 'Version: nmh-10000.0\n' >"${MHCONTEXT}"
92 script -c 'pick last' -f -q "$actual" >/dev
/null
&
94 grep 'Welcome to nmh version ' "$actual" >/dev
/null
&& false
96 # And make sure that version didn't get updated in context.
97 grep '^Version: nmh-10000.0$' "${MHCONTEXT}" >/dev
/null
101 start_test
'with MHCONTEXT but no version, no welcome and update'
102 printf '' >"${MHCONTEXT}"
103 script -c 'pick last' -f -q "$actual" >/dev
/null
&
105 grep 'Welcome to nmh version ' "$actual" >/dev
/null
&& false
106 # And make sure that version did get updated in context.
107 grep "^${version}$" "${MHCONTEXT}" >/dev
/null