diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-07-12 08:28:56 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-12 14:08:34 +0800 |
| commit | d079995fb81bf3d61f7698373442f61476b99fce (patch) | |
| tree | 27df065f0a9d2b58d90ad17a4cdea751a0b12156 /src/nvim/testdir/test_expand.vim | |
| parent | 6a670a00b3553a3ad87ddc6dfd06725796f58f1e (diff) | |
| download | rneovim-d079995fb81bf3d61f7698373442f61476b99fce.tar.gz rneovim-d079995fb81bf3d61f7698373442f61476b99fce.tar.bz2 rneovim-d079995fb81bf3d61f7698373442f61476b99fce.zip | |
vim-patch:8.2.0270: some code not covered by tests
Problem: Some code not covered by tests.
Solution: Add test cases. (Yegappan Lakshmanan, closes vim/vim#5649)
https://github.com/vim/vim/commit/bc2b71d44a0b90b6aeb3534a76912fccbe5577df
Diffstat (limited to 'src/nvim/testdir/test_expand.vim')
| -rw-r--r-- | src/nvim/testdir/test_expand.vim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_expand.vim b/src/nvim/testdir/test_expand.vim index 48dce25bb3..5a51903712 100644 --- a/src/nvim/testdir/test_expand.vim +++ b/src/nvim/testdir/test_expand.vim @@ -1,5 +1,7 @@ " Test for expanding file names +source shared.vim + func Test_with_directories() call mkdir('Xdir1') call mkdir('Xdir2') @@ -81,3 +83,30 @@ func Test_expandcmd() call assert_fails('call expandcmd("make %")', 'E499:') close endfunc + +" Test for expanding <sfile>, <slnum> and <sflnum> outside of sourcing a script +func Test_source_sfile() + let lines =<< trim [SCRIPT] + :call assert_fails('echo expandcmd("<sfile>")', 'E498:') + :call assert_fails('echo expandcmd("<slnum>")', 'E842:') + :call assert_fails('echo expandcmd("<sflnum>")', 'E961:') + :call assert_fails('call expandcmd("edit <cfile>")', 'E446:') + :call assert_fails('call expandcmd("edit #")', 'E194:') + :call assert_fails('call expandcmd("edit #<2")', 'E684:') + :call assert_fails('call expandcmd("edit <cword>")', 'E348:') + :call assert_fails('call expandcmd("edit <cexpr>")', 'E348:') + :call assert_fails('autocmd User MyCmd echo "<sfile>"', 'E498:') + :call writefile(v:errors, 'Xresult') + :qall! + + [SCRIPT] + call writefile(lines, 'Xscript') + if RunVim([], [], '--clean -s Xscript') + call assert_equal([], readfile('Xresult')) + endif + call delete('Xscript') + call delete('Xresult') +endfunc + + +" vim: shiftwidth=2 sts=2 expandtab |