Changed msg_style and msg_delim to be file static to m_getfld.c
[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 set -e
8
9 if test -z "${MH_OBJ_DIR}"; then
10     srcdir=`dirname "$0"`/../..
11     MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
12 fi
13
14 . "$MH_OBJ_DIR/test/common.sh"
15
16 setup_test
17
18 unset SIGNATURE
19
20 fullname=`${MH_OBJ_DIR}/test/getfullname`
21 run_test "${MH_LIB_DIR}/ap -format %(myname) ignore" \
22          "$fullname" "GECOS field test"
23
24 echo "Signature: Some Random Name 1" >> ${MH}
25
26 run_test "${MH_LIB_DIR}/ap -format %(myname) ignore" \
27          "Some Random Name 1" "MH Profile Signature test"
28
29 SIGNATURE="Some Random Name 2"
30 export SIGNATURE
31
32 run_test "${MH_LIB_DIR}/ap -format %(myname) ignore" \
33          "${SIGNATURE}" "SIGNATURE Environment test"
34
35 #### Test escaping of display names.
36 escape="${MH_OBJ_DIR}/test/getfullname"
37 run_test "$escape "'user'           'user'              'no escape'
38 run_test "$escape "'first.last'     '"first.last"'      'escape'
39 run_test "$escape "'"first.last"'   '"first.last"'      'already escaped'
40 run_test "$escape "'first.last"'    '"first.last"'      'missing initial "'
41 run_test "$escape "'"first.last'    '"first.last"'      'missing final "'
42 run_test "$escape "'embedded"quote' '"embedded\"quote"' 'embedded quote'
43 run_test "$escape "'server\name,#'  '"server\name"'     'Windows form'
44 run_test "$escape "'"'              '"\""'              'special "'
45 run_test "$escape "'('              '"("'               'special ('
46 run_test "$escape "')'              '")"'               'special )'
47 #### We stop at the first comma so this one gets eliminated:
48 run_test "$escape "','              ''                  'special ,'
49 run_test "$escape "'.'              '"."'               'special .'
50 run_test "$escape "':'              '":"'               'special :'
51 run_test "$escape "';'              '";"'               'special ;'
52 run_test "$escape "'<'              '"<"'               'special <'
53 run_test "$escape "'>'              '">"'               'special >'
54 run_test "$escape "'@'              '"@"'               'special @'
55 run_test "$escape "'['              '"["'               'special ['
56 run_test "$escape "'\\'             '"\\"'              'special \\'
57 run_test "$escape "']'              '"]"'               'special ]'
58
59 exit $failed