aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/diagnostic_spec.lua
diff options
context:
space:
mode:
authorsmolck <46855713+smolck@users.noreply.github.com>2021-11-21 19:40:06 -0600
committerGitHub <noreply@github.com>2021-11-21 18:40:06 -0700
commit04bfd20bb8dfa2cfa0ca357e3a9cea79ed47ad25 (patch)
treecfaf72de4edf601358a9cbc9855bbe6cabec403a /test/functional/lua/diagnostic_spec.lua
parent0d967f0298a355452f62b9c76c34e102a6b9016e (diff)
downloadrneovim-04bfd20bb8dfa2cfa0ca357e3a9cea79ed47ad25.tar.gz
rneovim-04bfd20bb8dfa2cfa0ca357e3a9cea79ed47ad25.tar.bz2
rneovim-04bfd20bb8dfa2cfa0ca357e3a9cea79ed47ad25.zip
fix(diagnostic): remove invalid buffers from cache (#16397)
Errors were being caused by invalid buffers being kept around in diagnostic_cache, so add a metatable to diagnostic_cache which attaches to new buffers in the cache, removing them after they are invalidated. Closes #16391. Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Diffstat (limited to 'test/functional/lua/diagnostic_spec.lua')
-rw-r--r--test/functional/lua/diagnostic_spec.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua
index cdf9a8a834..348b9de816 100644
--- a/test/functional/lua/diagnostic_spec.lua
+++ b/test/functional/lua/diagnostic_spec.lua
@@ -343,6 +343,16 @@ describe('vim.diagnostic', function()
eq(0, result[5])
eq(3, result[6])
end)
+
+ it("doesn't error after bwipeout on buffer", function()
+ exec_lua [[
+ vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { lnum = 0, end_lnum = 0, col = 0, end_col = 0 })
+ vim.cmd("bwipeout! " .. diagnostic_bufnr)
+
+ vim.diagnostic.show(diagnostic_ns)
+ vim.diagnostic.hide(diagnostic_ns)
+ ]]
+ end)
end)
describe('enable() and disable()', function()
@@ -629,6 +639,15 @@ describe('vim.diagnostic', function()
]])
end)
+
+ it("doesn't error after bwipeout called on buffer", function()
+ exec_lua [[
+ vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { lnum = 0, end_lnum = 0, col = 0, end_col = 0 })
+ vim.cmd("bwipeout! " .. diagnostic_bufnr)
+
+ vim.diagnostic.reset(diagnostic_ns)
+ ]]
+ end)
end)
describe('get_next_pos()', function()