From 1fe1bb084d0099fc4f9bfdc11189485d0f74b75a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 19 Dec 2022 16:37:45 +0000 Subject: refactor(options): deprecate nvim[_buf|_win]_[gs]et_option Co-authored-by: zeertzjq Co-authored-by: famiu --- test/functional/plugin/editorconfig_spec.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test/functional/plugin/editorconfig_spec.lua') diff --git a/test/functional/plugin/editorconfig_spec.lua b/test/functional/plugin/editorconfig_spec.lua index e6a2550aba..4ad9903032 100644 --- a/test/functional/plugin/editorconfig_spec.lua +++ b/test/functional/plugin/editorconfig_spec.lua @@ -3,7 +3,6 @@ local clear = helpers.clear local command = helpers.command local eq = helpers.eq local pathsep = helpers.get_pathsep() -local curbufmeths = helpers.curbufmeths local funcs = helpers.funcs local meths = helpers.meths @@ -13,7 +12,7 @@ local function test_case(name, expected) local filename = testdir .. pathsep .. name command('edit ' .. filename) for opt, val in pairs(expected) do - eq(val, curbufmeths.get_option(opt), name) + eq(val, meths.get_option_value(opt, {buf=0}), name) end end -- cgit From cbbda3bcd77595eeabcc0fb70cee513e473833e6 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Mon, 5 Jun 2023 11:53:13 -0500 Subject: fix(editorconfig): check that buffer is valid (#23922) Fixes: https://github.com/neovim/neovim/issues/23921 --- test/functional/plugin/editorconfig_spec.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/functional/plugin/editorconfig_spec.lua') 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) -- cgit From abb8c2c453d1e084f8ab3e9bbaa8b27515c81a9f Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 25 Aug 2023 12:23:05 +0100 Subject: fix(editorconfig): do not set 'endofline' Problem: 'endofline' can be used to detect if a file ends of , however editorconfig can break this. Solution: Set 'endofline' during BufWritePre Fixes: #24869 --- test/functional/plugin/editorconfig_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/plugin/editorconfig_spec.lua') diff --git a/test/functional/plugin/editorconfig_spec.lua b/test/functional/plugin/editorconfig_spec.lua index 5e38c03b56..ac78003a8c 100644 --- a/test/functional/plugin/editorconfig_spec.lua +++ b/test/functional/plugin/editorconfig_spec.lua @@ -160,8 +160,8 @@ describe('editorconfig', function() end) it('sets newline options', function() - test_case('with_newline.txt', { fixendofline = true, endofline = true }) - test_case('without_newline.txt', { fixendofline = false, endofline = false }) + test_case('with_newline.txt', { fixendofline = true }) + test_case('without_newline.txt', { fixendofline = false }) end) it('respects trim_trailing_whitespace', function() -- cgit