diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-17 21:33:30 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-17 21:33:30 +0100 |
commit | bc2b71d44a0b90b6aeb3534a76912fccbe5577df (patch) | |
tree | a77a42312e3d84710013ca0ba0f919ab79867560 /src/testdir/test_expand.vim | |
parent | b13af50f73dd89503c915f76fcf92be58789521a (diff) | |
download | vim-git-bc2b71d44a0b90b6aeb3534a76912fccbe5577df.tar.gz |
patch 8.2.0270: some code not covered by testsv8.2.0270
Problem: Some code not covered by tests.
Solution: Add test cases. (Yegappan Lakshmanan, closes #5649)
Diffstat (limited to 'src/testdir/test_expand.vim')
-rw-r--r-- | src/testdir/test_expand.vim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/testdir/test_expand.vim b/src/testdir/test_expand.vim index 48dce25bb..5a5190371 100644 --- a/src/testdir/test_expand.vim +++ b/src/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 |