mirror of
https://github.com/neovim/neovim.git
synced 2026-01-24 05:40:35 +00:00
fix(api): make nvim_parse_cmd propagate errors
Makes `nvim_parse_cmd` propagate any errors that occur while parsing to give the user a better idea of what's wrong with the command.
This commit is contained in:
@@ -3426,10 +3426,15 @@ describe('API', function()
|
||||
}, meths.parse_cmd('MyCommand test it', {}))
|
||||
end)
|
||||
it('errors for invalid command', function()
|
||||
eq('Error while parsing command line', pcall_err(meths.parse_cmd, 'Fubar', {}))
|
||||
eq('Error while parsing command line', pcall_err(meths.parse_cmd, '', {}))
|
||||
eq('Error while parsing command line', pcall_err(meths.parse_cmd, '" foo', {}))
|
||||
eq('Error while parsing command line: E492: Not an editor command: Fubar',
|
||||
pcall_err(meths.parse_cmd, 'Fubar', {}))
|
||||
command('command! Fubar echo foo')
|
||||
eq('Error while parsing command line', pcall_err(meths.parse_cmd, 'Fubar!', {}))
|
||||
eq('Error while parsing command line', pcall_err(meths.parse_cmd, '4,6Fubar', {}))
|
||||
eq('Error while parsing command line: E477: No ! allowed',
|
||||
pcall_err(meths.parse_cmd, 'Fubar!', {}))
|
||||
eq('Error while parsing command line: E481: No range allowed',
|
||||
pcall_err(meths.parse_cmd, '4,6Fubar', {}))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user