aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-04-09 12:11:32 +0800
committerGitHub <noreply@github.com>2026-04-09 04:11:32 +0000
commit9c5fba5df0b60cd25ac2c180a7d82fca47a105e6 (patch)
tree60e64ae61d5a2b09313c0bfe88889340ff452939 /test/functional/lua/vim_spec.lua
parent3a4a66017b74192caaf9af9af172bdc08e0c1608 (diff)
downloadrneovim-9c5fba5df0b60cd25ac2c180a7d82fca47a105e6.tar.gz
rneovim-9c5fba5df0b60cd25ac2c180a7d82fca47a105e6.tar.bz2
rneovim-9c5fba5df0b60cd25ac2c180a7d82fca47a105e6.zip
fix(messages): truncate warning messages only in display (#38901)
For now, add a private "_truncate" flag to nvim_echo, using a truncation method similar to showmode().
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua35
1 files changed, 22 insertions, 13 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index e80fb777f3..7ab615afa7 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -134,18 +134,20 @@ describe('lua stdlib', function()
describe(('vim.deprecate prerel=%s,'):format(prerel or 'nil'), function()
local curver --- @type {major:number, minor:number}
+ local curstr --- @type string
+ local nextver --- @type string
before_each(function()
curver = exec_lua('return vim.version()')
+ -- "0.10" or "0.10-dev+xxx"
+ curstr = ('%s.%s%s'):format(curver.major, curver.minor, prerel or '')
+ -- "0.10" or "0.11"
+ nextver = ('%s.%s'):format(curver.major, curver.minor + (prerel and 0 or 1))
end)
it('plugin=nil, same message skipped', function()
- -- "0.10" or "0.10-dev+xxx"
- local curstr = ('%s.%s%s'):format(curver.major, curver.minor, prerel or '')
eq(
- ([[foo.bar() is deprecated. Run ":checkhealth vim.deprecated" for more information]]):format(
- curstr
- ),
+ [[foo.bar() is deprecated. Run ":checkhealth vim.deprecated" for more information]],
exec_lua('return vim.deprecate(...)', 'foo.bar()', 'zub.wooo{ok=yay}', curstr)
)
-- Same message as above; skipped this time.
@@ -160,19 +162,26 @@ describe('lua stdlib', function()
end)
it('plugin=nil, show error if hard-deprecated', function()
- -- "0.10" or "0.11"
- local nextver = ('%s.%s'):format(curver.major, curver.minor + (prerel and 0 or 1))
-
- local was_removed = prerel and 'was removed' or 'will be removed'
eq(
- dedent(
- [[
- foo.hard_dep() is deprecated. Run ":checkhealth vim.deprecated" for more information]]
- ):format(was_removed, nextver),
+ [[foo.hard_dep() is deprecated. Run ":checkhealth vim.deprecated" for more information]],
exec_lua('return vim.deprecate(...)', 'foo.hard_dep()', 'vim.new_api()', nextver)
)
end)
+ it('plugin=nil, message is only truncated in display #38841', function()
+ local screen = Screen.new(50, 10)
+ exec_lua('vim.deprecate(...)', 'foo.bar()', 'zub.wooo{ok=yay}', curstr)
+ screen:expect([[
+ ^ |
+ {1:~ }|*8
+ {19:foo.bar() is deprecated. Run ":checkhealth vim.dep}|
+ ]])
+ eq(
+ [[foo.bar() is deprecated. Run ":checkhealth vim.deprecated" for more information]],
+ n.exec_capture('messages')
+ )
+ end)
+
it('plugin specified', function()
-- When `plugin` is specified, don't show ":help deprecated". #22235
eq(