diff options
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/api/vim_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/shell/viml_system_spec.lua | 29 |
2 files changed, 35 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 6a61607d2e..abf9c9efcd 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -105,4 +105,10 @@ describe('vim_* functions', function() eq(nvim('get_windows')[2], nvim('get_current_window')) end) end) + + it('can throw exceptions', function() + local status, err = pcall(nvim, 'get_option', 'invalid-option') + eq(false, status) + ok(err:match('Invalid option name') ~= nil) + end) end) diff --git a/test/functional/shell/viml_system_spec.lua b/test/functional/shell/viml_system_spec.lua index 6dde2ef538..9ed1016f73 100644 --- a/test/functional/shell/viml_system_spec.lua +++ b/test/functional/shell/viml_system_spec.lua @@ -19,6 +19,15 @@ local function delete_file(name) end end +-- Some tests require the xclip program and a x server. +local xclip = nil +do + if os.getenv('DISPLAY') then + local proc = io.popen('which xclip') + xclip = proc:read() + proc:close() + end +end describe('system()', function() before_each(clear) @@ -85,6 +94,15 @@ describe('system()', function() end) end) end) + + if xclip then + describe("with a program that doesn't close stdout", function() + it('will exit properly after passing input', function() + eq(nil, eval([[system('xclip -i -selection clipboard', 'clip-data')]])) + eq('clip-data', eval([[system('xclip -o -selection clipboard')]])) + end) + end) + end end) describe('systemlist()', function() @@ -140,4 +158,15 @@ describe('systemlist()', function() end) end) end) + + if xclip then + describe("with a program that doesn't close stdout", function() + it('will exit properly after passing input', function() + eq(nil, eval( + "systemlist('xclip -i -selection clipboard', ['clip', 'data'])")) + eq({'clip', 'data'}, eval( + "systemlist('xclip -o -selection clipboard')")) + end) + end) + end end) |