view src/testdir/test_fnameescape.vim @ 21907:f4e21796f47d v8.2.1503

patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script Commit: https://github.com/vim/vim/commit/81e17fbe00fd2ed93b262adc3ba41c86b02e7f46 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 21 21:55:43 2020 +0200 patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script Problem: Vim9: error for an autocmd defined in a :def function in legacy Vim script. Solution: Don't check the variable type. (closes #6758)
author Bram Moolenaar <Bram@vim.org>
date Fri, 21 Aug 2020 22:00:04 +0200
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