view src/testdir/test_fnameescape.vim @ 27897:2a2c0958a913 v8.2.4474

patch 8.2.4474: memory allocation failures not tested in quickfix code Commit: https://github.com/vim/vim/commit/5a2d4a3ecb67942d47615507a163ffcd5863c073 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sat Feb 26 10:31:32 2022 +0000 patch 8.2.4474: memory allocation failures not tested in quickfix code Problem: Memory allocation failures not tested in quickfix code. Solution: Add alloc IDs and tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/9848)
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Feb 2022 11: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