diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
commit | 931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch) | |
tree | d8c1843a95da5ea0bb4acc09f7e37843d9995c86 /test/functional/plugin/editorconfig_spec.lua | |
parent | 142d9041391780ac15b89886a54015fdc5c73995 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-userreg.tar.gz rneovim-userreg.tar.bz2 rneovim-userreg.zip |
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'test/functional/plugin/editorconfig_spec.lua')
-rw-r--r-- | test/functional/plugin/editorconfig_spec.lua | 19 |
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) |