aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/ui_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 22:40:31 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 22:40:31 +0000
commit339e2d15cc26fe86988ea06468d912a46c8d6f29 (patch)
treea6167fc8fcfc6ae2dc102f57b2473858eac34063 /test/functional/lua/ui_spec.lua
parent067dc73729267c0262438a6fdd66e586f8496946 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-339e2d15cc26fe86988ea06468d912a46c8d6f29.tar.gz
rneovim-339e2d15cc26fe86988ea06468d912a46c8d6f29.tar.bz2
rneovim-339e2d15cc26fe86988ea06468d912a46c8d6f29.zip
Merge remote-tracking branch 'upstream/master' into fix_repeatcmdline
Diffstat (limited to 'test/functional/lua/ui_spec.lua')
-rw-r--r--test/functional/lua/ui_spec.lua27
1 files changed, 24 insertions, 3 deletions
diff --git a/test/functional/lua/ui_spec.lua b/test/functional/lua/ui_spec.lua
index 9ee99b4905..d4c150c5f2 100644
--- a/test/functional/lua/ui_spec.lua
+++ b/test/functional/lua/ui_spec.lua
@@ -1,9 +1,12 @@
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
local eval = helpers.eval
+local is_ci = helpers.is_ci
+local is_os = helpers.is_os
local poke_eventloop = helpers.poke_eventloop
describe('vim.ui', function()
@@ -11,8 +14,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 +49,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 +132,23 @@ describe('vim.ui', function()
end)
end)
+
+ describe('open()', function()
+ it('validation', function()
+ if is_os('win') or not is_ci('github') then
+ exec_lua[[vim.system = function() return { wait=function() return { code=3} end } end]]
+ end
+ if not is_os('bsd') then
+ matches('vim.ui.open: command failed %(%d%): { "[^"]+", .*"non%-existent%-file" }',
+ exec_lua[[local _, err = vim.ui.open('non-existent-file') ; return err]])
+ end
+
+ exec_lua[[
+ vim.fn.has = function() return 0 end
+ vim.fn.executable = function() return 0 end
+ ]]
+ eq('vim.ui.open: no handler found (tried: wslview, xdg-open)',
+ exec_lua[[local _, err = vim.ui.open('foo') ; return err]])
+ end)
+ end)
end)