diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-12-03 09:05:20 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-03 09:05:20 +0800 |
| commit | c0840087c83175267667a355131d4dffccfd8ff5 (patch) | |
| tree | be47cfc360ca4f467228d2c900fe5202bd6693a5 /src/nvim/testdir/test_gf.vim | |
| parent | 10c50d9f30138e7811789ba1c62f4c520cf04c8f (diff) | |
| parent | 5e97984188e95de419ba5a710a060f0614c6c9e0 (diff) | |
| download | rneovim-c0840087c83175267667a355131d4dffccfd8ff5.tar.gz rneovim-c0840087c83175267667a355131d4dffccfd8ff5.tar.bz2 rneovim-c0840087c83175267667a355131d4dffccfd8ff5.zip | |
Merge pull request #21267 from zeertzjq/vim-8.2.3900
vim-patch:8.2.{3900,partial:3908}: it is not easy to use a script-local function for an option
Diffstat (limited to 'src/nvim/testdir/test_gf.vim')
| -rw-r--r-- | src/nvim/testdir/test_gf.vim | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_gf.vim b/src/nvim/testdir/test_gf.vim index b2bb189688..e369645328 100644 --- a/src/nvim/testdir/test_gf.vim +++ b/src/nvim/testdir/test_gf.vim @@ -226,6 +226,32 @@ func Test_gf_includeexpr() delfunc IncFunc endfunc +" Test for using a script-local function for 'includeexpr' +func Test_includeexpr_scriptlocal_func() + func! s:IncludeFunc() + let g:IncludeFname = v:fname + return '' + endfunc + set includeexpr=s:IncludeFunc() + call assert_equal(expand('<SID>') .. 'IncludeFunc()', &includeexpr) + new | only + call setline(1, 'TestFile1') + let g:IncludeFname = '' + call assert_fails('normal! gf', 'E447:') + call assert_equal('TestFile1', g:IncludeFname) + bw! + set includeexpr=<SID>IncludeFunc() + call assert_equal(expand('<SID>') .. 'IncludeFunc()', &includeexpr) + new | only + call setline(1, 'TestFile2') + let g:IncludeFname = '' + call assert_fails('normal! gf', 'E447:') + call assert_equal('TestFile2', g:IncludeFname) + set includeexpr& + delfunc s:IncludeFunc + bw! +endfunc + " Check that expanding directories can handle more than 255 entries. func Test_gf_subdirs_wildcard() let cwd = getcwd() |