mirror of
https://github.com/neovim/neovim.git
synced 2026-04-18 05:20:40 +00:00
fix(api): avoid error when parsing invalid expr after :echo (#38695)
Problem: Parsing :echo followed by invalid expression leads to error. Solution: Suppress error when skipping over expression.
This commit is contained in:
@@ -4828,6 +4828,16 @@ describe('API', function()
|
||||
eq('execute', result.cmd)
|
||||
eq('edit foo', result.nextcmd)
|
||||
end)
|
||||
it('parses expr-arg commands with invalid expr #38689', function()
|
||||
for _, arg in ipairs({ '&', '[', '{', '"', "'" }) do
|
||||
local result = api.nvim_parse_cmd('echo ' .. arg, {})
|
||||
eq({ arg }, result.args)
|
||||
eq('echo', result.cmd)
|
||||
eq('', result.nextcmd)
|
||||
end
|
||||
-- v:errmsg shouldn't be set
|
||||
eq('', api.nvim_get_vvar('errmsg'))
|
||||
end)
|
||||
it('parses :map commands with space in RHS', function()
|
||||
eq({
|
||||
addr = 'none',
|
||||
|
||||
Reference in New Issue
Block a user