File: test-myname

package info (click to toggle)
nmh 1.6-16
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 6,312 kB
  • ctags: 3,934
  • sloc: ansic: 48,921; sh: 16,427; makefile: 560; perl: 509; lex: 402; awk: 74
file content (59 lines) | stat: -rwxr-xr-x 2,343 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#
# Test that we can retrieve the local username via the passwd file,
# the Signature profile entry, and via SIGNATURE environment variable.
#

set -e

if test -z "${MH_OBJ_DIR}"; then
    srcdir=`dirname "$0"`/../..
    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
fi

. "$MH_OBJ_DIR/test/common.sh"

setup_test

unset SIGNATURE

fullname=`${MH_OBJ_DIR}/test/getfullname`
run_test "${MH_LIB_DIR}/ap -format %(myname) ignore" \
         "$fullname" "GECOS field test"

echo "Signature: Some Random Name 1" >> ${MH}

run_test "${MH_LIB_DIR}/ap -format %(myname) ignore" \
         "Some Random Name 1" "MH Profile Signature test"

SIGNATURE="Some Random Name 2"
export SIGNATURE

run_test "${MH_LIB_DIR}/ap -format %(myname) ignore" \
         "${SIGNATURE}" "SIGNATURE Environment test"

#### Test escaping of display names.
escape="${MH_OBJ_DIR}/test/getfullname"
run_test "$escape "'user'           'user'              'no escape'
run_test "$escape "'first.last'     '"first.last"'      'escape'
run_test "$escape "'"first.last"'   '"first.last"'      'already escaped'
run_test "$escape "'first.last"'    '"first.last"'      'missing initial "'
run_test "$escape "'"first.last'    '"first.last"'      'missing final "'
run_test "$escape "'embedded"quote' '"embedded\"quote"' 'embedded quote'
run_test "$escape "'server\name,#'  '"server\name"'     'Windows form'
run_test "$escape "'"'              '"\""'              'special "'
run_test "$escape "'('              '"("'               'special ('
run_test "$escape "')'              '")"'               'special )'
#### We stop at the first comma so this one gets eliminated:
run_test "$escape "','              ''                  'special ,'
run_test "$escape "'.'              '"."'               'special .'
run_test "$escape "':'              '":"'               'special :'
run_test "$escape "';'              '";"'               'special ;'
run_test "$escape "'<'              '"<"'               'special <'
run_test "$escape "'>'              '">"'               'special >'
run_test "$escape "'@'              '"@"'               'special @'
run_test "$escape "'['              '"["'               'special ['
run_test "$escape "'\\'             '"\\"'              'special \\'
run_test "$escape "']'              '"]"'               'special ]'

exit $failed