aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-09-03 17:14:25 +0100
committerLewis Russell <me@lewisr.dev>2024-09-04 11:34:19 +0100
commitb6e350a6b4df40fcc99931c460668c36fadc9989 (patch)
tree37a22c94c5d38e9a3bdf57b08ae7b5a7ea747d7b /test/functional/lua/vim_spec.lua
parent7b7c95dac97d6ea4f10855cc198dce650a796c20 (diff)
downloadrneovim-b6e350a6b4df40fcc99931c460668c36fadc9989.tar.gz
rneovim-b6e350a6b4df40fcc99931c460668c36fadc9989.tar.bz2
rneovim-b6e350a6b4df40fcc99931c460668c36fadc9989.zip
fix(lua): allows tables with integer keys to be merged in tbl_deep_extend
- The exclusion of lists was never justified in the commit history and is the wrong thing to do for a function that deals with tables. - Move the error checks out of the recursive path. Fixes #23654
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index df68020d8e..7bba24483e 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -1059,7 +1059,7 @@ describe('lua stdlib', function()
local a = { a = {[2] = 3} }
local b = { a = {[3] = 3} }
local c = vim.tbl_deep_extend("force", a, b)
- return vim.deep_equal(c, {a = {[3] = 3}})
+ return vim.deep_equal(c, {a = {[2] = 3, [3] = 3}})
]]))
eq(
@@ -1071,6 +1071,14 @@ describe('lua stdlib', function()
]])
)
+ -- Fix github issue #23654
+ ok(exec_lua([[
+ local a = { sub = { [1] = 'a' } }
+ local b = { sub = { b = 'a' } }
+ local c = vim.tbl_deep_extend('force', a, b)
+ return vim.deep_equal(c, { sub = { [1] = 'a', b = 'a' } })
+ ]]))
+
matches(
'invalid "behavior": nil',
pcall_err(