Merge #23401 vim.ui.open: "gx" without netrw

This commit is contained in:
Justin M. Keyes
2023-07-05 00:30:05 -07:00
committed by GitHub
7 changed files with 139 additions and 16 deletions

View File

@@ -1,9 +1,11 @@
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_os = helpers.is_os
local poke_eventloop = helpers.poke_eventloop
describe('vim.ui', function()
@@ -11,8 +13,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 +48,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 +131,20 @@ describe('vim.ui', function()
end)
end)
describe('open()', function()
it('validation', function()
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)