From 55c4393e9f80ac3e7233da889efce4f760e41664 Mon Sep 17 00:00:00 2001 From: Shadman <13149513+shadmansaleh@users.noreply.github.com> Date: Sun, 2 Jan 2022 01:35:15 +0600 Subject: feat(lua): add support for multiple optional types in vim.validate (#16864) --- test/functional/lua/vim_spec.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/functional/lua') diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 317f92fcdc..9bf376b6fe 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -906,6 +906,7 @@ describe('lua stdlib', function() exec_lua("vim.validate{arg1={nil, 'thread', true }}") exec_lua("vim.validate{arg1={{}, 't' }, arg2={ 'foo', 's' }}") exec_lua("vim.validate{arg1={2, function(a) return (a % 2) == 0 end, 'even number' }}") + exec_lua("vim.validate{arg1={5, {'n', 's'} }, arg2={ 'foo', {'n', 's'} }}") matches('expected table, got number', pcall_err(exec_lua, "vim.validate{ 1, 'x' }")) @@ -935,6 +936,8 @@ describe('lua stdlib', function() pcall_err(exec_lua, "vim.validate{arg1={3, function(a) return a == 1 end, 'even number'}}")) matches('arg1: expected %?, got 3', pcall_err(exec_lua, "vim.validate{arg1={3, function(a) return a == 1 end}}")) + matches('arg1: expected number|string, got nil', + pcall_err(exec_lua, "vim.validate{ arg1={ nil, {'n', 's'} }}")) -- Pass an additional message back. matches('arg1: expected %?, got 3. Info: TEST_MSG', -- cgit