aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/editorconfig_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/plugin/editorconfig_spec.lua')
-rw-r--r--test/functional/plugin/editorconfig_spec.lua19
1 files changed, 15 insertions, 4 deletions
diff --git a/test/functional/plugin/editorconfig_spec.lua b/test/functional/plugin/editorconfig_spec.lua
index e6a2550aba..ac78003a8c 100644
--- a/test/functional/plugin/editorconfig_spec.lua
+++ b/test/functional/plugin/editorconfig_spec.lua
@@ -3,9 +3,9 @@ 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
+local exec_lua = helpers.exec_lua
local testdir = 'Xtest-editorconfig'
@@ -13,7 +13,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
@@ -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()
@@ -207,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)