mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 07:16:09 +00:00
fix(api): use a conditional stack for nvim_cmd
(cherry picked from commit c0b9bdc4a3
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
7f74d9bd77
commit
2fed9d83bc
@@ -4458,5 +4458,24 @@ describe('API', function()
|
||||
ok(luv.now() - start <= 300)
|
||||
end)
|
||||
end)
|
||||
it(':call with unknown function does not crash #26289', function()
|
||||
eq('Vim:E117: Unknown function: UnknownFunc',
|
||||
pcall_err(meths.cmd, {cmd = 'call', args = {'UnknownFunc()'}}, {}))
|
||||
end)
|
||||
it(':throw does not crash #24556', function()
|
||||
eq('42', pcall_err(meths.cmd, {cmd = 'throw', args = {'42'}}, {}))
|
||||
end)
|
||||
it('can use :return #24556', function()
|
||||
exec([[
|
||||
func Foo()
|
||||
let g:pos = 'before'
|
||||
call nvim_cmd({'cmd': 'return', 'args': ['[1, 2, 3]']}, {})
|
||||
let g:pos = 'after'
|
||||
endfunc
|
||||
let g:result = Foo()
|
||||
]])
|
||||
eq('before', meths.get_var('pos'))
|
||||
eq({1, 2, 3}, meths.get_var('result'))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user