view src/testdir/test_fnameescape.vim @ 23191:3e7723bab4e5 v8.2.2141

patch 8.2.2141: a user command with try/catch may not catch an expression error Commit: https://github.com/vim/vim/commit/8143a53c533bc7776c57e5db063d185bdd5750f3 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 13 20:26:29 2020 +0100 patch 8.2.2141: a user command with try/catch may not catch an expression error Problem: A user command with try/catch may not catch an expression error. Solution: When an expression fails check for following "|". (closes https://github.com/vim/vim/issues/7469)
author Bram Moolenaar <Bram@vim.org>
date Sun, 13 Dec 2020 20:30:04 +0100
parents 08940efa6b4e
children
line wrap: on
line source

" Test if fnameescape is correct for special chars like !

func Test_fnameescape()
  let fname = 'Xspa ce'
  let status = v:false
  try
    exe "w! " . fnameescape(fname)
    let status = v:true
  endtry
  call assert_true(status, "Space")
  call delete(fname)

  let fname = 'Xemark!'
  let status = v:false
  try
    exe "w! " . fname->fnameescape()
    let status = v:true
  endtry
  call assert_true(status, "ExclamationMark")
  call delete(fname)

  call assert_equal('\-', fnameescape('-'))
  call assert_equal('\+', fnameescape('+'))
  call assert_equal('\>', fnameescape('>'))
endfunc

" vim: shiftwidth=2 sts=2 expandtab