diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-01-09 10:36:25 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-01-10 23:58:56 +0100 |
commit | 5055d4a755d3c100cddf51bded77abca04beb971 (patch) | |
tree | add3e83843cdc030ad38b1c33f40bdda419f457b /test/functional/api/vim_spec.lua | |
parent | c095f83116eb8ef87983ca5fea61053755fbc4e5 (diff) | |
download | rneovim-5055d4a755d3c100cddf51bded77abca04beb971.tar.gz rneovim-5055d4a755d3c100cddf51bded77abca04beb971.tar.bz2 rneovim-5055d4a755d3c100cddf51bded77abca04beb971.zip |
api: nvim_command_output: direct impl
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index d213c3c34e..39db831fe3 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -69,11 +69,36 @@ describe('api', function() eq({mode='n', blocking=false}, nvim("get_mode")) end) - it('returns command output', function() + it('captures command output', function() eq('this is\nspinal tap', nvim('command_output', [[echo "this is\nspinal tap"]])) end) + it('captures empty command output', function() + eq('', nvim('command_output', 'echo')) + end) + + it('captures single-char command output', function() + eq('x', nvim('command_output', 'echo "x"')) + end) + + it('captures multiple commands', function() + eq('foo\n 1 %a "[No Name]" line 1', + nvim('command_output', 'echo "foo" | ls')) + end) + + it('captures nested execute()', function() + eq('\nnested1\nnested2\n 1 %a "[No Name]" line 1', + nvim('command_output', + [[echo execute('echo "nested1\nnested2"') | ls]])) + end) + + it('captures nested nvim_command_output()', function() + eq('nested1\nnested2\n 1 %a "[No Name]" line 1', + nvim('command_output', + [[echo nvim_command_output('echo "nested1\nnested2"') | ls]])) + end) + it('does not return shell |:!| output', function() eq(':!echo "foo"\r\n', nvim('command_output', [[!echo "foo"]])) end) |