]> granicus.if.org Git - vim/commitdiff
patch 7.4.2178 v7.4.2178
authorBram Moolenaar <Bram@vim.org>
Sun, 7 Aug 2016 14:36:40 +0000 (16:36 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 7 Aug 2016 14:36:40 +0000 (16:36 +0200)
Problem:    No test for reading from stdin.
Solution:   Add a test.

src/testdir/shared.vim
src/testdir/test_startup.vim
src/version.c

index a9b090543d3303d70220f69b9046bfa2998a2e46..ad8afe1ff2af702f3b64e5fa43e63ba42cfd75f0 100644 (file)
@@ -122,11 +122,15 @@ func WaitFor(expr)
 endfunc
 
 " Run Vim, using the "vimcmd" file and "-u NORC".
-" "before" is a list of commands to be executed before loading plugins.
-" "after" is a list of commands to be executed after loading plugins.
+" "before" is a list of Vim commands to be executed before loading plugins.
+" "after" is a list of Vim commands to be executed after loading plugins.
 " Plugins are not loaded, unless 'loadplugins' is set in "before".
 " Return 1 if Vim could be executed.
 func RunVim(before, after, arguments)
+  call RunVimPiped(a:before, a:after, a:arguments, '')
+endfunc
+
+func RunVimPiped(before, after, arguments, pipecmd)
   if !filereadable('vimcmd')
     return 0
   endif
@@ -145,7 +149,13 @@ func RunVim(before, after, arguments)
   if cmd !~ '-u NONE'
     let cmd = cmd . ' -u NONE'
   endif
-  exe "silent !" . cmd . args . ' ' . a:arguments
+
+  " With pipecmd we can't set VIMRUNTIME.
+  if a:pipecmd != ''
+    let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '')
+  endif
+
+  exe "silent !" . a:pipecmd . cmd . args . ' ' . a:arguments
 
   if len(a:before) > 0
     call delete('Xbefore.vim')
index 384dcbe2e0c6b1a8c4f2a2573c7314b39d91901a..652318fb7cb53e9f1c79b0f48cd71885310cb0d0 100644 (file)
@@ -169,3 +169,15 @@ func Test_startuptime()
   endif
   call delete('Xtestout')
 endfunc
+
+func Test_read_stdin()
+  let after = [
+       \ 'write Xtestout',
+       \ 'quit!',
+       \ ]
+  if RunVimPiped([], after, '-', 'echo something | ')
+    let lines = readfile('Xtestout')
+    call assert_equal('something', lines[0])
+  endif
+  call delete('Xtestout')
+endfunc
index 29d845fa15cb2647f2282aa3d48aa80e483b5b69..d87abe85cbaf57378f3c78fd6832e11ee8b10773 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2178,
 /**/
     2177,
 /**/