aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/lua/vim_spec.lua25
-rw-r--r--test/functional/plugin/lsp/diagnostic_spec.lua32
2 files changed, 57 insertions, 0 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index 976e63b44d..4e2bed4deb 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -603,6 +603,31 @@ describe('lua stdlib', function()
return vim.tbl_islist(c) and count == 0
]]))
+ eq(exec_lua([[
+ local a = { a = { b = 1 } }
+ local b = { a = {} }
+ return vim.tbl_deep_extend("force", a, b)
+ ]]), {a = {b = 1}})
+
+ eq(exec_lua([[
+ local a = { a = 123 }
+ local b = { a = { b = 1} }
+ return vim.tbl_deep_extend("force", a, b)
+ ]]), {a = {b = 1}})
+
+ ok(exec_lua([[
+ 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}})
+ ]]))
+
+ eq(exec_lua([[
+ local a = { a = { b = 1} }
+ local b = { a = 123 }
+ return vim.tbl_deep_extend("force", a, b)
+ ]]), {a = 123 })
+
eq('Error executing lua: vim/shared.lua:0: invalid "behavior": nil',
pcall_err(exec_lua, [[
return vim.tbl_deep_extend()
diff --git a/test/functional/plugin/lsp/diagnostic_spec.lua b/test/functional/plugin/lsp/diagnostic_spec.lua
index c1c76c3916..7359ee4bce 100644
--- a/test/functional/plugin/lsp/diagnostic_spec.lua
+++ b/test/functional/plugin/lsp/diagnostic_spec.lua
@@ -241,6 +241,38 @@ describe('vim.lsp.diagnostic', function()
]]))
end)
+ it('should not display diagnostics when disabled', function()
+ eq({0, 2}, exec_lua [[
+ local server_1_diags = {
+ make_error("Error 1", 1, 1, 1, 5),
+ make_warning("Warning on Server 1", 2, 1, 2, 5),
+ }
+ local server_2_diags = {
+ make_warning("Warning 1", 2, 1, 2, 5),
+ }
+
+ vim.lsp.diagnostic.on_publish_diagnostics(nil, nil, { uri = fake_uri, diagnostics = server_1_diags }, 1)
+ vim.lsp.diagnostic.on_publish_diagnostics(nil, nil, { uri = fake_uri, diagnostics = server_2_diags }, 2)
+
+ vim.lsp.diagnostic.disable(diagnostic_bufnr, 1)
+
+ return {
+ count_of_extmarks_for_client(diagnostic_bufnr, 1),
+ count_of_extmarks_for_client(diagnostic_bufnr, 2),
+ }
+ ]])
+
+ eq({4, 0}, exec_lua [[
+ vim.lsp.diagnostic.enable(diagnostic_bufnr, 1)
+ vim.lsp.diagnostic.disable(diagnostic_bufnr, 2)
+
+ return {
+ count_of_extmarks_for_client(diagnostic_bufnr, 1),
+ count_of_extmarks_for_client(diagnostic_bufnr, 2),
+ }
+ ]])
+ end)
+
describe('reset', function()
it('diagnostic count is 0 and displayed diagnostics are 0 after call', function()
-- 1 Error (1)