aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2023-01-04 14:36:18 -0700
committerGregory Anders <greg@gpanders.com>2023-01-07 08:19:12 -0700
commit34d1eaa792fa332cea190568967a489e324fca6f (patch)
treeccc218ca7e709141c455b5ffe76aaf9cb9604023 /test
parent42afa0369a3c01dddd1efef1397bbf46011f391b (diff)
downloadrneovim-34d1eaa792fa332cea190568967a489e324fca6f.tar.gz
rneovim-34d1eaa792fa332cea190568967a489e324fca6f.tar.bz2
rneovim-34d1eaa792fa332cea190568967a489e324fca6f.zip
feat(editorconfig): allow editorconfig to be toggled dynamically
Rather than only check `editorconfig_enable` when the plugin is loaded, check it each time the autocommand fires, so that users may enable or disable it dynamically. Also check for a buffer local version of the variable, so that editorconfig can be enabled or disabled per-buffer.
Diffstat (limited to 'test')
-rw-r--r--test/functional/plugin/editorconfig_spec.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/plugin/editorconfig_spec.lua b/test/functional/plugin/editorconfig_spec.lua
index f71b8088ed..ad95b9a07e 100644
--- a/test/functional/plugin/editorconfig_spec.lua
+++ b/test/functional/plugin/editorconfig_spec.lua
@@ -4,6 +4,8 @@ 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
local testdir = 'Xtest-editorconfig'
@@ -191,4 +193,18 @@ But not this one
it('sets textwidth', function()
test_case('max_line_length.txt', { textwidth = 42 })
end)
+
+ it('can be disabled globally', function()
+ meths.set_var('editorconfig_enable', false)
+ meths.set_option_value('shiftwidth', 42, {})
+ test_case('3_space.txt', { shiftwidth = 42 })
+ end)
+
+ it('can be disabled per-buffer', function()
+ meths.set_option_value('shiftwidth', 42, {})
+ local bufnr = funcs.bufadd(testdir .. pathsep .. '3_space.txt')
+ meths.buf_set_var(bufnr, 'editorconfig_enable', false)
+ test_case('3_space.txt', { shiftwidth = 42 })
+ test_case('4_space.py', { shiftwidth = 4 })
+ end)
end)