]> git.marmaro.de Git - mmh/blobdiff - test/format/test-myname
Added function escape_display_name() to double quote, if not already,
[mmh] / test / format / test-myname
index 2b48c2f165899d41d531f5c18b6967b237fa7e17..d9dca2dcc5676f16bc5f1f98e242b8fc2da9a68b 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