aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/utility_functions_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-01-14 18:08:17 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2019-01-14 20:12:57 +0100
commit3a84e5be8840d7fe2bf98f7f268f07489a3bb30f (patch)
treeabd088e785a89740a716494b8a30a191df384ea8 /test/functional/lua/utility_functions_spec.lua
parent89d7e24891c2281e301c232c4ad882b135c11bde (diff)
downloadrneovim-3a84e5be8840d7fe2bf98f7f268f07489a3bb30f.tar.gz
rneovim-3a84e5be8840d7fe2bf98f7f268f07489a3bb30f.tar.bz2
rneovim-3a84e5be8840d7fe2bf98f7f268f07489a3bb30f.zip
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.
Diffstat (limited to 'test/functional/lua/utility_functions_spec.lua')
-rw-r--r--test/functional/lua/utility_functions_spec.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/lua/utility_functions_spec.lua b/test/functional/lua/utility_functions_spec.lua
index 6e4cfd98ef..67f5ce24f7 100644
--- a/test/functional/lua/utility_functions_spec.lua
+++ b/test/functional/lua/utility_functions_spec.lua
@@ -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)