options: setlocal should only set local value

For 'iminsert' and 'imsearch' the global value was always changed.
This commit is contained in:
Jakob Schnitzer
2017-03-26 13:20:44 +02:00
parent eb0e94f71b
commit e47622f26b
2 changed files with 22 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
-- Tests for :setlocal and :setglobal
local helpers = require('test.functional.helpers')(after_each)
local clear, execute, eval, eq, nvim =
helpers.clear, helpers.execute, helpers.eval, helpers.eq, helpers.nvim
local function get_num_option_global(opt)
return nvim('command_output', 'setglobal ' .. opt .. '?'):match('%d+')
end
describe(':setlocal', function()
before_each(clear)
it('setlocal sets only local value', function()
eq('0', get_num_option_global('iminsert'))
execute('setlocal iminsert=1')
eq('0', get_num_option_global('iminsert'))
eq('0', get_num_option_global('imsearch'))
execute('setlocal imsearch=1')
eq('0', get_num_option_global('imsearch'))
end)
end)