aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorFamiu Haque <famiuhaque@protonmail.com>2022-05-05 23:11:57 +0600
committerFamiu Haque <famiuhaque@protonmail.com>2022-05-05 23:11:57 +0600
commit511f06a56e77f612f7bc8ca563ebecb7239a9914 (patch)
tree018ca187cedf763615c9799d8b81cf52f45691a1 /test/functional/api/vim_spec.lua
parent1eecea8449557572295837d3213b2fdb42ce74ef (diff)
downloadrneovim-511f06a56e77f612f7bc8ca563ebecb7239a9914.tar.gz
rneovim-511f06a56e77f612f7bc8ca563ebecb7239a9914.tar.bz2
rneovim-511f06a56e77f612f7bc8ca563ebecb7239a9914.zip
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.
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 610036f484..11c1fc6c2c 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -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)