aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authorShadman <13149513+shadmansaleh@users.noreply.github.com>2022-01-02 01:35:15 +0600
committerGitHub <noreply@github.com>2022-01-01 12:35:15 -0700
commit55c4393e9f80ac3e7233da889efce4f760e41664 (patch)
tree1488db2d6b08a1688d47de65a9bc457ff5edc1b8 /test/functional/lua/vim_spec.lua
parentf86039de1e6583cbdb48a33d89c782ff65baf767 (diff)
downloadrneovim-55c4393e9f80ac3e7233da889efce4f760e41664.tar.gz
rneovim-55c4393e9f80ac3e7233da889efce4f760e41664.tar.bz2
rneovim-55c4393e9f80ac3e7233da889efce4f760e41664.zip
feat(lua): add support for multiple optional types in vim.validate (#16864)
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua3
1 files changed, 3 insertions, 0 deletions
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',