mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
lua: expose full interface of vim.inspect and add test
Implement lazy loading for vim.submodule, this would be over-engineering for inspect only, but we expect to use this solution also for more and larger modules.
This commit is contained in:
@@ -176,6 +176,16 @@ describe("vim.inspect", function()
|
||||
eq('2', inspect(2))
|
||||
eq('{+a = {+b = 1+}+}',
|
||||
inspect({ a = { b = 1 } }, { newline = '+', indent = '' }))
|
||||
|
||||
-- special value vim.inspect.KEY works
|
||||
eq('{ KEY_a = "x", KEY_b = "y"}', meths.execute_lua([[
|
||||
return vim.inspect({a="x", b="y"}, {newline = '', process = function(item, path)
|
||||
if path[#path] == vim.inspect.KEY then
|
||||
return 'KEY_'..item
|
||||
end
|
||||
return item
|
||||
end})
|
||||
]], {}))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
Reference in New Issue
Block a user