aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2023-03-15 08:56:13 -0400
committerGitHub <noreply@github.com>2023-03-15 05:56:13 -0700
commit210120dde81ec289ae01e1d247df08f0b147c08a (patch)
treee97b7cd1f8d1ed1bbafc4f443b29dd146817bd49 /test/functional/lua/vim_spec.lua
parent21eacbfef399f124e9d50f1757c89453c4e02944 (diff)
downloadrneovim-210120dde81ec289ae01e1d247df08f0b147c08a.tar.gz
rneovim-210120dde81ec289ae01e1d247df08f0b147c08a.tar.bz2
rneovim-210120dde81ec289ae01e1d247df08f0b147c08a.zip
fix(lua): vim.deprecate() shows ":help deprecated" #22677
Problem: vim.deprecate() shows ":help deprecated" for third-party plugins. ":help deprecated" only describes deprecations in Nvim, and is unrelated to any 3rd party deprecations. Solution: If `plugin` is specified, don't show ":help deprecated". fix #22235
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index 470102df5e..0483ec46f0 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -127,6 +127,22 @@ describe('lua stdlib', function()
eq(1, funcs.luaeval('vim.stricmp("\\0C\\0", "\\0B\\0")'))
end)
+ it('vim.deprecate', function()
+ -- vim.deprecate(name, alternative, version, plugin, backtrace)
+ eq(dedent[[
+ foo.bar() is deprecated, use zub.wooo{ok=yay} instead. :help deprecated
+ This feature will be removed in Nvim version 2.17]],
+ exec_lua('return vim.deprecate(...)', 'foo.bar()', 'zub.wooo{ok=yay}', '2.17'))
+ -- Same message, skipped.
+ eq(vim.NIL,
+ exec_lua('return vim.deprecate(...)', 'foo.bar()', 'zub.wooo{ok=yay}', '2.17'))
+ -- When `plugin` is specified, don't show ":help deprecated". #22235
+ eq(dedent[[
+ foo.bar() is deprecated, use zub.wooo{ok=yay} instead.
+ This feature will be removed in my-plugin.nvim version 0.3.0]],
+ exec_lua('return vim.deprecate(...)', 'foo.bar()', 'zub.wooo{ok=yay}', '0.3.0', 'my-plugin.nvim', false))
+ end)
+
it('vim.startswith', function()
eq(true, funcs.luaeval('vim.startswith("123", "1")'))
eq(true, funcs.luaeval('vim.startswith("123", "")'))