diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-11-10 19:01:53 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-11-10 19:01:53 -0500 |
commit | 3080672650b1a6583684edfdafef7e07c0c7cf56 (patch) | |
tree | 888527c926d8117c21d291311e34f271614cf66f /test/functional/shell/viml_system_spec.lua | |
parent | b0cd397a43ae18942e12b1c76f838aac135b18cf (diff) | |
parent | 3e8ef31ada1f2ae0b0cd58bb25d5516d19eee82d (diff) | |
download | rneovim-3080672650b1a6583684edfdafef7e07c0c7cf56.tar.gz rneovim-3080672650b1a6583684edfdafef7e07c0c7cf56.tar.bz2 rneovim-3080672650b1a6583684edfdafef7e07c0c7cf56.zip |
Merge pull request #1448 from tarruda/shell-systemlist-test-fixes
Fixes to shell.c, systemlist and functional tests
Diffstat (limited to 'test/functional/shell/viml_system_spec.lua')
-rw-r--r-- | test/functional/shell/viml_system_spec.lua | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/test/functional/shell/viml_system_spec.lua b/test/functional/shell/viml_system_spec.lua index a8bab8e26e..91e115aedf 100644 --- a/test/functional/shell/viml_system_spec.lua +++ b/test/functional/shell/viml_system_spec.lua @@ -3,8 +3,8 @@ -- - `systemlist()` local helpers = require('test.functional.helpers') -local eq, clear, eval, feed = - helpers.eq, helpers.clear, helpers.eval, helpers.feed +local eq, clear, eval, feed, nvim = + helpers.eq, helpers.clear, helpers.eval, helpers.feed, helpers.nvim local function create_file_with_nuls(name) @@ -55,6 +55,21 @@ describe('system()', function() end) end) + describe('passing a lot of input', function() + it('returns the program output', function() + local input = {} + -- write more than 1mb of data, which should be enough to overcome + -- the os buffer limit and force multiple event loop iterations to write + -- everything + for i = 1, 0xffff do + input[#input + 1] = '01234567890ABCDEFabcdef' + end + input = table.concat(input, '\n') + nvim('set_var', 'input', input) + eq(input, eval('system("cat -", g:input)')) + end) + end) + describe('passing number as input', function() it('stringifies the input', function() eq('1', eval('system("cat", 1)')) @@ -129,6 +144,17 @@ describe('systemlist()', function() end) end) + describe('passing a lot of input', function() + it('returns the program output', function() + local input = {} + for i = 1, 0xffff do + input[#input + 1] = '01234567890ABCDEFabcdef' + end + nvim('set_var', 'input', input) + eq(input, eval('systemlist("cat -", g:input)')) + end) + end) + describe('with output containing NULs', function() local fname = 'Xtest' @@ -166,7 +192,7 @@ describe('systemlist()', function() if xclip then describe("with a program that doesn't close stdout", function() it('will exit properly after passing input', function() - eq(nil, eval( + eq({}, eval( "systemlist('xclip -i -selection clipboard', ['clip', 'data'])")) eq({'clip', 'data'}, eval( "systemlist('xclip -o -selection clipboard')")) |