diff options
Diffstat (limited to 'test/functional/lua/ui_spec.lua')
-rw-r--r-- | test/functional/lua/ui_spec.lua | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/test/functional/lua/ui_spec.lua b/test/functional/lua/ui_spec.lua index 9ee99b4905..0f66aad7b3 100644 --- a/test/functional/lua/ui_spec.lua +++ b/test/functional/lua/ui_spec.lua @@ -1,5 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local eq = helpers.eq +local matches = helpers.matches local exec_lua = helpers.exec_lua local clear = helpers.clear local feed = helpers.feed @@ -11,8 +12,7 @@ describe('vim.ui', function() clear() end) - - describe('select', function() + describe('select()', function() it('can select an item', function() local result = exec_lua[[ local items = { @@ -47,7 +47,7 @@ describe('vim.ui', function() end) end) - describe('input', function() + describe('input()', function() it('can input text', function() local result = exec_lua[[ local opts = { @@ -130,4 +130,18 @@ describe('vim.ui', function() end) end) + + describe('open()', function() + it('validation', function() + exec_lua[[vim.ui.open('non-existent-file')]] + matches('vim.ui.open: command failed %(%d%): { "[^"]+", "non%-existent%-file" }', eval('v:errmsg')) + + exec_lua[[ + vim.fn.has = function() return 0 end + vim.fn.executable = function() return 0 end + ]] + exec_lua[[vim.ui.open('foo')]] + eq('vim.ui.open: no handler found (tried: wslview, xdg-open)', eval('v:errmsg')) + end) + end) end) |