mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
fix(shared): avoid indexing unindexable values in vim.tbl_get() (#18337)
This commit is contained in:
@@ -492,6 +492,10 @@ describe('lua stdlib', function()
|
||||
|
||||
it('vim.tbl_get', function()
|
||||
eq(true, exec_lua("return vim.tbl_get({ test = { nested_test = true }}, 'test', 'nested_test')"))
|
||||
eq(NIL, exec_lua("return vim.tbl_get({ unindexable = true }, 'unindexable', 'missing_key')"))
|
||||
eq(NIL, exec_lua("return vim.tbl_get({ unindexable = 1 }, 'unindexable', 'missing_key')"))
|
||||
eq(NIL, exec_lua("return vim.tbl_get({ unindexable = coroutine.create(function () end) }, 'unindexable', 'missing_key')"))
|
||||
eq(NIL, exec_lua("return vim.tbl_get({ unindexable = function () end }, 'unindexable', 'missing_key')"))
|
||||
eq(NIL, exec_lua("return vim.tbl_get({}, 'missing_key')"))
|
||||
eq(NIL, exec_lua("return vim.tbl_get({})"))
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user