Rearranged test suite environment variables so that individual tests
[mmh] / test / format / test-myhost
1 #!/bin/sh
2 #
3 # Test that the %(myhost) function returns the local hostname and
4 # the localname entry out of the mts configuration file.
5 #
6
7 if test -z "${MH_OBJ_DIR}"; then
8     srcdir=`dirname $0`/../..
9     MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
10 fi
11
12 . "$MH_OBJ_DIR/test/common.sh"
13
14 setup_test
15
16 runtest()
17 {
18         testoutput=$(${MH_LIB_DIR}/ap -format "%(myhost)" ignore)
19
20         if [ x"$1" != x"${testoutput}" ]; then
21                 echo "For $2, expected $1 but got ${testoutput}"
22                 exit 1
23         fi
24 }
25
26 runtest "$(hostname)" "local hostname test"
27
28 cp ${MHMTSCONF} ${MH_TEST_DIR}/Mail/mts.conf || exit 1
29 export MHMTSCONF="${MH_TEST_DIR}/Mail/mts.conf"
30
31 echo "localname: some.random.name" >> ${MHMTSCONF}
32
33 runtest "some.random.name" "mts.conf localname test"
34
35 exit 0