Rearranged test suite environment variables so that individual tests
[mmh] / test / format / test-myname
1 #!/bin/sh
2 #
3 # Test that we can retrieve the local username via the passwd file,
4 # the Signature profile entry, and via SIGNATURE environment variable.
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 unset SIGNATURE 
17
18 runtest()
19 {
20         testoutput=$(${MH_LIB_DIR}/ap -format "%(myname)" ignore)
21
22         if [ x"$1" != x"${testoutput}" ]; then
23                 echo "For $2, expected $1 but got ${testoutput}"
24                 exit 1
25         fi
26 }
27
28 runtest "$(${MH_OBJ_DIR}/test/getfullname)" "GECOS field test"
29
30 echo "Signature: Some Random Name 1" >> ${MH}
31
32 runtest "Some Random Name 1" "MH Profile Signature test"
33
34 export SIGNATURE="Some Random Name 2"
35
36 runtest "${SIGNATURE}" "SIGNATURE Environment test"
37
38 exit 0