aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_expand.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-12 14:45:36 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-12 16:23:32 +0800
commit4aa4675fbface275224d178ebb436bc214dd1056 (patch)
treec54a5272b2cc8415b82549ba48381e423791090c /src/nvim/testdir/test_expand.vim
parent01afd43bc90408b43db906845245a4959c8ee3a0 (diff)
downloadrneovim-4aa4675fbface275224d178ebb436bc214dd1056.tar.gz
rneovim-4aa4675fbface275224d178ebb436bc214dd1056.tar.bz2
rneovim-4aa4675fbface275224d178ebb436bc214dd1056.zip
vim-patch:8.2.0293: various Ex commands not sufficiently tested
Problem: Various Ex commands not sufficiently tested. Solution: Add more test cases. (Yegappan Lakshmanan, closes vim/vim#5673) https://github.com/vim/vim/commit/818fc9ad143911b2faa0d7cee86724aa70a02080 Needs to assert E170 instead of E580 because patch 8.2.3486 has been ported but patch 8.2.1183 hasn't.
Diffstat (limited to 'src/nvim/testdir/test_expand.vim')
-rw-r--r--src/nvim/testdir/test_expand.vim18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_expand.vim b/src/nvim/testdir/test_expand.vim
index 5a51903712..d86fea4f45 100644
--- a/src/nvim/testdir/test_expand.vim
+++ b/src/nvim/testdir/test_expand.vim
@@ -81,7 +81,11 @@ func Test_expandcmd()
call assert_fails('call expandcmd("make <afile>")', 'E495:')
enew
call assert_fails('call expandcmd("make %")', 'E499:')
- close
+ let $FOO="blue\tsky"
+ call setline(1, "$FOO")
+ call assert_equal("grep pat blue\tsky", expandcmd('grep pat <cfile>'))
+ unlet $FOO
+ close!
endfunc
" Test for expanding <sfile>, <slnum> and <sflnum> outside of sourcing a script
@@ -108,5 +112,17 @@ func Test_source_sfile()
call delete('Xresult')
endfunc
+" Test for expanding filenames multiple times in a command line
+func Test_expand_filename_multicmd()
+ edit foo
+ call setline(1, 'foo!')
+ new
+ call setline(1, 'foo!')
+ new <cword> | new <cWORD>
+ call assert_equal(4, winnr('$'))
+ call assert_equal('foo!', bufname(winbufnr(1)))
+ call assert_equal('foo', bufname(winbufnr(2)))
+ %bwipe!
+endfunc
" vim: shiftwidth=2 sts=2 expandtab