aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/editorconfig_spec.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2023-06-05 11:53:13 -0500
committerGitHub <noreply@github.com>2023-06-05 11:53:13 -0500
commitcbbda3bcd77595eeabcc0fb70cee513e473833e6 (patch)
tree446894cae91733d936a72e7c9153c6742bff21a0 /test/functional/plugin/editorconfig_spec.lua
parentf959753e5cbc3500fedcf0de25acff0ce72e8b7f (diff)
downloadrneovim-cbbda3bcd77595eeabcc0fb70cee513e473833e6.tar.gz
rneovim-cbbda3bcd77595eeabcc0fb70cee513e473833e6.tar.bz2
rneovim-cbbda3bcd77595eeabcc0fb70cee513e473833e6.zip
fix(editorconfig): check that buffer is valid (#23922)
Fixes: https://github.com/neovim/neovim/issues/23921
Diffstat (limited to 'test/functional/plugin/editorconfig_spec.lua')
-rw-r--r--test/functional/plugin/editorconfig_spec.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/functional/plugin/editorconfig_spec.lua b/test/functional/plugin/editorconfig_spec.lua
index 4ad9903032..5e38c03b56 100644
--- a/test/functional/plugin/editorconfig_spec.lua
+++ b/test/functional/plugin/editorconfig_spec.lua
@@ -5,6 +5,7 @@ local eq = helpers.eq
local pathsep = helpers.get_pathsep()
local funcs = helpers.funcs
local meths = helpers.meths
+local exec_lua = helpers.exec_lua
local testdir = 'Xtest-editorconfig'
@@ -206,4 +207,15 @@ But not this one
test_case('3_space.txt', { shiftwidth = 42 })
test_case('4_space.py', { shiftwidth = 4 })
end)
+
+ it('does not operate on invalid buffers', function()
+ local ok, err = unpack(exec_lua([[
+ vim.cmd.edit('test.txt')
+ local bufnr = vim.api.nvim_get_current_buf()
+ vim.cmd.bwipeout(bufnr)
+ return {pcall(require('editorconfig').config, bufnr)}
+ ]]))
+
+ eq(true, ok, err)
+ end)
end)