Added function escape_display_name() to double quote, if not already,
[mmh] / test / format / test-myname
index 2b48c2f..d9dca2d 100755 (executable)
@@ -31,4 +31,25 @@ export SIGNATURE="Some Random Name 2"
 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 "'embedded"quote' '"embedded\"quote"' 'embedded quote'
+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