diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-08-07 16:36:40 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-08-07 16:36:40 +0200 |
commit | 3a938383396d4ab352bbb4d806938302debdae2c (patch) | |
tree | f700bdd239a46a1b534a27eec05c701c511ac749 /src | |
parent | ba98bef1910094179bf90b9467b6e2d2f9462601 (diff) |
patch 7.4.2178v7.4.2178
Problem: No test for reading from stdin.
Solution: Add a test.
Diffstat (limited to 'src')
-rw-r--r-- | src/testdir/shared.vim | 16 | ||||
-rw-r--r-- | src/testdir/test_startup.vim | 12 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 27 insertions, 3 deletions
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim index a9b090543d..ad8afe1ff2 100644 --- a/src/testdir/shared.vim +++ b/src/testdir/shared.vim @@ -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') diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim index 384dcbe2e0..652318fb7c 100644 --- a/src/testdir/test_startup.vim +++ b/src/testdir/test_startup.vim @@ -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 diff --git a/src/version.c b/src/version.c index 29d845fa15..d87abe85cb 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2178, +/**/ 2177, /**/ 2176, |