diff src/testdir/test_expand.vim @ 19471:cb73f4ae6b7c v8.2.0293

patch 8.2.0293: various Ex commands not sufficiently tested Commit: https://github.com/vim/vim/commit/818fc9ad143911b2faa0d7cee86724aa70a02080 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 21 17:54:45 2020 +0100 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 https://github.com/vim/vim/issues/5673)
author Bram Moolenaar <Bram@vim.org>
date Fri, 21 Feb 2020 18:00:05 +0100
parents 67fbe280a502
children 031184ace7c5
line wrap: on
line diff
--- a/src/testdir/test_expand.vim
+++ b/src/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