mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
fix(lua): return after assert returns assert message (#27064)
This commit is contained in:
parent
f5d59340a6
commit
5aa14e1231
@ -180,10 +180,8 @@ local all_namespaces = {}
|
|||||||
---@return vim.diagnostic.Severity?
|
---@return vim.diagnostic.Severity?
|
||||||
local function to_severity(severity)
|
local function to_severity(severity)
|
||||||
if type(severity) == 'string' then
|
if type(severity) == 'string' then
|
||||||
return assert(
|
assert(M.severity[string.upper(severity)], string.format('Invalid severity: %s', severity))
|
||||||
M.severity[string.upper(severity)],
|
return M.severity[string.upper(severity)]
|
||||||
string.format('Invalid severity: %s', severity)
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
return severity
|
return severity
|
||||||
end
|
end
|
||||||
|
@ -77,7 +77,8 @@ function M.to_lpeg(pattern)
|
|||||||
})
|
})
|
||||||
|
|
||||||
local lpeg_pattern = p:match(pattern) --[[@as vim.lpeg.Pattern?]]
|
local lpeg_pattern = p:match(pattern) --[[@as vim.lpeg.Pattern?]]
|
||||||
return assert(lpeg_pattern, 'Invalid glob')
|
assert(lpeg_pattern, 'Invalid glob')
|
||||||
|
return lpeg_pattern
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -1123,10 +1123,8 @@ function M._test()
|
|||||||
'if "expected" is given, "actual" is also required'
|
'if "expected" is given, "actual" is also required'
|
||||||
)
|
)
|
||||||
if expected then
|
if expected then
|
||||||
return assert(
|
assert(cond, ('expected %s, got: %s'):format(vim.inspect(expected), vim.inspect(actual)))
|
||||||
cond,
|
return cond
|
||||||
('expected %s, got: %s'):format(vim.inspect(expected), vim.inspect(actual))
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
return assert(cond)
|
return assert(cond)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user