3 # Test that the %(mymbox) function correctly determines whether or not
4 # a particular email address is "mine" or not
7 if test -z "${MH_OBJ_DIR}"; then
8 srcdir=`dirname "$0"`/../..
9 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
12 . "$MH_OBJ_DIR/test/common.sh"
16 user=${LOGNAME:-`id -un`}
17 host=`${MH_OBJ_DIR}/test/getfqdn`
19 run_test "${MH_LIB_DIR}/ap -format %(mymbox{text}) ${user}" \
21 run_test "${MH_LIB_DIR}/ap -format %(mymbox{text}) ${user}@${host}" \
22 1 "Basic user@host test"
23 run_test "${MH_LIB_DIR}/ap -format %(mymbox{text}) nosuchuser@nosuchhost.blah" \
24 0 "Basic non-matching test"
26 myname="Random User <random@user.something.com>"
28 #### Remove existing Local-Mailbox: profile component, if any. Then
30 grep -v 'Local-Mailbox: ' ${MH} > ${MH}.new
32 echo "Local-Mailbox: ${myname}" >> ${MH}
34 run_test "echo `${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${myname}"`" \
35 1 "Local-Mailbox test"
37 run_test "${MH_LIB_DIR}/ap -format %(mymbox{text}) ${user}@${host}" \
38 0 "Local-mailbox overriding user@host test"