aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/ui_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2023-07-04 23:33:23 +0200
committerJustin M. Keyes <justinkz@gmail.com>2023-07-05 00:49:10 +0200
commite644e7ce0b36dd5e75770f3faa0a84f15e2561e8 (patch)
tree32a5501e84a465b5cd1b5c315b7795854ae73d78 /test/functional/lua/ui_spec.lua
parent67b2ed1004ae551c9fe1bbd29a86b5a301570800 (diff)
downloadrneovim-e644e7ce0b36dd5e75770f3faa0a84f15e2561e8.tar.gz
rneovim-e644e7ce0b36dd5e75770f3faa0a84f15e2561e8.tar.bz2
rneovim-e644e7ce0b36dd5e75770f3faa0a84f15e2561e8.zip
fix(vim.ui.open): return (don't show) error message
Problem: Showing an error via vim.notify() makes it awkward for callers such as lsp/handlers.lua to avoid showing redundant errors. Solution: Return the message instead of showing it. Let the caller decide whether and when to show the message.
Diffstat (limited to 'test/functional/lua/ui_spec.lua')
-rw-r--r--test/functional/lua/ui_spec.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/functional/lua/ui_spec.lua b/test/functional/lua/ui_spec.lua
index 0f66aad7b3..d1b64419af 100644
--- a/test/functional/lua/ui_spec.lua
+++ b/test/functional/lua/ui_spec.lua
@@ -5,6 +5,7 @@ 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()
@@ -133,15 +134,17 @@ describe('vim.ui', function()
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'))
+ 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
]]
- exec_lua[[vim.ui.open('foo')]]
- eq('vim.ui.open: no handler found (tried: wslview, xdg-open)', eval('v:errmsg'))
+ eq('vim.ui.open: no handler found (tried: wslview, xdg-open)',
+ exec_lua[[local _, err = vim.ui.open('foo') ; return err]])
end)
end)
end)