4e1dfaa35b540c5495dacdb11c7c618cd2a9e000
[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 [ -z "${MH_TEST_COMMON}" ]; then
8         echo "MH_TEST_COMMON not set; try running via 'make check'"
9 fi
10
11 . ${MH_TEST_COMMON}
12
13 setup_test
14
15 unset SIGNATURE 
16
17 runtest()
18 {
19         testoutput=$(${MH_LIB_DIR}/ap -format "%(myname)" ignore)
20
21         if [ x"$1" != x"${testoutput}" ]; then
22                 echo "For $2, expected $1 but got ${testoutput}"
23                 exit 1
24         fi
25 }
26
27 runtest "$(${MH_OBJ_DIR}/test/getfullname)" "GECOS field test"
28
29 echo "Signature: Some Random Name 1" >> ${MH}
30
31 runtest "Some Random Name 1" "MH Profile Signature test"
32
33 export SIGNATURE="Some Random Name 2"
34
35 runtest "${SIGNATURE}" "SIGNATURE Environment test"
36
37 exit 0