Fixed test suite to work with Solaris Bourne shell:
[mmh] / test / format / test-mymbox
1 #!/bin/sh
2 #
3 # Test that the %(mymbox) function correctly determines whether or not
4 # a particular email address is "mine" or not
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 user=`id -un`
17 host=`${MH_OBJ_DIR}/test/getfqdn`
18
19 run_test "${MH_LIB_DIR}/ap -format %(mymbox{text}) ${user}" \
20          1 "Basic user test"
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"
25
26 myname="Random User <random@user.something.com>"
27
28 echo "Local-Mailbox: ${myname}" >> ${MH}
29
30 run_test "echo `${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${myname}"`" \
31          1 "Local-Mailbox test"
32
33 run_test "${MH_LIB_DIR}/ap -format %(mymbox{text}) ${user}@${host}" \
34          0 "Local-mailbox overriding user@host test"
35
36 exit $failed