aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-05-04 16:36:32 -0700
committerGitHub <noreply@github.com>2025-05-04 16:36:32 -0700
commit40351bbbbe7891db9bdeb0d6c3bd95e2e0309775 (patch)
tree6867de8e1ab91af46d4ddec13c3b7ee120c0d659 /test/functional/lua/vim_spec.lua
parent0862c1036a8e45c594ed279dd4576719f93614c5 (diff)
downloadrneovim-40351bbbbe7891db9bdeb0d6c3bd95e2e0309775.tar.gz
rneovim-40351bbbbe7891db9bdeb0d6c3bd95e2e0309775.tar.bz2
rneovim-40351bbbbe7891db9bdeb0d6c3bd95e2e0309775.zip
fix(lua): vim.validate `message` param #33675
Problem: vim.validate does not handle `message` param. Solution: Add the missing logic.
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index f9cd051d1f..0a76af70d1 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -1556,11 +1556,16 @@ describe('lua stdlib', function()
pcall_err(exec_lua, "vim.validate('arg1', nil, {'number', 'string'})")
)
- -- Pass an additional message back.
+ -- Validator func can return an extra "Info" message.
matches(
'arg1: expected %?, got 3. Info: TEST_MSG',
pcall_err(exec_lua, "vim.validate('arg1', 3, function(a) return a == 1, 'TEST_MSG' end)")
)
+ -- Caller can override the "expected" message.
+ eq(
+ 'arg1: expected TEST_MSG, got nil',
+ pcall_err(exec_lua, "vim.validate('arg1', nil, 'table', 'TEST_MSG')")
+ )
end)
it('vim.validate (spec form)', function()