From 40351bbbbe7891db9bdeb0d6c3bd95e2e0309775 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 4 May 2025 16:36:32 -0700 Subject: fix(lua): vim.validate `message` param #33675 Problem: vim.validate does not handle `message` param. Solution: Add the missing logic. --- test/functional/lua/vim_spec.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test/functional/lua/vim_spec.lua') 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() -- cgit