Mercurial > vim
view src/testdir/test_fnameescape.vim @ 31624:d605a50e7623 v9.0.1144
patch 9.0.1144: reading beyond text
Commit: https://github.com/vim/vim/commit/c32949b0779106ed5710ae3bffc5053e49083ab4
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 4 15:56:51 2023 +0000
patch 9.0.1144: reading beyond text
Problem: Reading beyond text.
Solution: Add strlen_maxlen() and use it.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 04 Jan 2023 17:00:05 +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