run_test "${MH_LIB_DIR}/ap -format %(myname) ignore" \
"Some Random Name 1" "MH Profile Signature test"
-export SIGNATURE="Some Random Name 2"
+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