diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2026-04-02 07:05:47 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-01 23:05:47 +0000 |
| commit | f2cdf73afc7307fc65ab21134bcc4549ac34b2d4 (patch) | |
| tree | a950c9c8b38762f7ff26f089e838fae3531f6e5f /test/functional/api/vim_spec.lua | |
| parent | 0851ac2706e9ea174222e781ccaf598e760dcc67 (diff) | |
| download | rneovim-f2cdf73afc7307fc65ab21134bcc4549ac34b2d4.tar.gz rneovim-f2cdf73afc7307fc65ab21134bcc4549ac34b2d4.tar.bz2 rneovim-f2cdf73afc7307fc65ab21134bcc4549ac34b2d4.zip | |
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.
Diffstat (limited to 'test/functional/api/vim_spec.lua')
| -rw-r--r-- | test/functional/api/vim_spec.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index f9227d9cea..d625d2667c 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -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', |