aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/shared.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2020-09-12 19:04:22 -0700
committerTJ DeVries <devries.timothyj@gmail.com>2020-10-05 09:47:59 -0400
commit8e77d70e29f936f4e708ee3244046188b8ad0383 (patch)
treede9bfa3d5704cf9cfb92fc9a50157718d940b518 /runtime/lua/vim/shared.lua
parentaad7a74053e16611de04da4151e3e3be50746e3d (diff)
downloadrneovim-8e77d70e29f936f4e708ee3244046188b8ad0383.tar.gz
rneovim-8e77d70e29f936f4e708ee3244046188b8ad0383.tar.bz2
rneovim-8e77d70e29f936f4e708ee3244046188b8ad0383.zip
test/vim.validate(): assert normalized stacktrace
- The previous commit lost information in the tests. Instead, add some more "normalization" substitutions in pcall_err(), so that the general shape of the stacktrace is included in the asserted text. - Eliminate contains(), it is redundant with matches()
Diffstat (limited to 'runtime/lua/vim/shared.lua')
-rw-r--r--runtime/lua/vim/shared.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua
index 750af02f19..995c52e8ed 100644
--- a/runtime/lua/vim/shared.lua
+++ b/runtime/lua/vim/shared.lua
@@ -514,20 +514,20 @@ do
local optional = (true == spec[3])
if type(t) == 'string' then
- local translated_type_name = type_names[t]
- if not translated_type_name then
+ local t_name = type_names[t]
+ if not t_name then
return false, string.format('invalid type name: %s', t)
end
- if (not optional or val ~= nil) and not _is_type(val, translated_type_name) then
- return false, string.format("%s: expected %s, got %s", param_name, translated_type_name, type(val))
+ if (not optional or val ~= nil) and not _is_type(val, t_name) then
+ return false, string.format("%s: expected %s, got %s", param_name, t_name, type(val))
end
elseif vim.is_callable(t) then
-- Check user-provided validation function.
local valid, optional_message = t(val)
if not valid then
local error_message = string.format("%s: expected %s, got %s", param_name, (spec[3] or '?'), val)
- if not (optional_message == nil) then
+ if optional_message ~= nil then
error_message = error_message .. string.format(". Info: %s", optional_message)
end