view src/testdir/test_fnameescape.vim @ 24051:da8347e453b4 v8.2.2567

patch 8.2.2567: Vim9: no error if variable is defined for existing function Commit: https://github.com/vim/vim/commit/6c3843ca8ab105bfb85f6ea8bcec2cbc03f46e7f Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 4 12:38:21 2021 +0100 patch 8.2.2567: Vim9: no error if variable is defined for existing function Problem: Vim9: no error if variable is defined for existing function. Solution: Check if name isn't already in use. (closes https://github.com/vim/vim/issues/7897)
author Bram Moolenaar <Bram@vim.org>
date Thu, 04 Mar 2021 12:45:03 +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