]>
diplodocus.org Git - nmh/blob - test/format/test-mymbox
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 #### Use ap to get the username. That will either be what's in the
17 #### Local-Mailbox profile component, which we don't use in the test
18 #### suite, or the user's login name. ap will escape (quote) it if
20 user
=`run_prog ${MH_LIB_DIR}/ap -format '%(me)' 0`
21 host=`${MH_OBJ_DIR}/test/getcanon`
23 output
=`run_prog ${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${user}"`
24 run_test
"echo $output" 1 "Basic user test"
25 output
=`run_prog ${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${user}@${host}"`
26 run_test
"echo $output" 1 "Basic user@host test"
27 run_test
"${MH_LIB_DIR}/ap -format %(mymbox{text}) nosuchuser@nosuchhost.blah" \
28 0 "Basic non-matching test"
30 myname
="Random User <random@user.something.com>"
32 #### Remove existing Local-Mailbox: profile component, if any. Then
34 grep -v 'Local-Mailbox: ' ${MH} > ${MH}.new
36 echo "Local-Mailbox: ${myname}" >> ${MH}
39 `run_prog ${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${myname}"`" \
40 1 "Local-Mailbox test"
42 output
=`run_prog ${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${user}@${host}"`
43 run_test
"echo $output" 0 "Local-mailbox overriding user@host test"
45 # Add an Alternate-Mailbox. This caused ismymbox() to lose the
46 # Local-Mailbox, Bug #36635: -nocc me doesn't account for
47 # Alternate-Mailboxes.
48 printf 'Alternate-Mailboxes: user@example.com\n' >> $MH
50 `run_prog ${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${myname}"`" \
51 1 "Local-Mailbox with Alternate-Mailbox test"