mirror of
https://github.com/neovim/neovim.git
synced 2025-11-05 02:04:29 +00:00
options: add some tests
This commit is contained in:
@@ -8,6 +8,16 @@ local function get_num_option_global(opt)
|
|||||||
return nvim('command_output', 'setglobal ' .. opt .. '?'):match('%d+')
|
return nvim('command_output', 'setglobal ' .. opt .. '?'):match('%d+')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function should_fail(opt, value, errmsg)
|
||||||
|
execute('let v:errmsg = ""')
|
||||||
|
execute('setglobal ' .. opt .. '=' .. value)
|
||||||
|
eq(errmsg, eval("v:errmsg"):match("E%d*:"))
|
||||||
|
execute('let v:errmsg = ""')
|
||||||
|
execute('setlocal ' .. opt .. '=' .. value)
|
||||||
|
eq(errmsg, eval("v:errmsg"):match("E%d*:"))
|
||||||
|
execute('let v:errmsg = ""')
|
||||||
|
end
|
||||||
|
|
||||||
describe(':setlocal', function()
|
describe(':setlocal', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
@@ -20,3 +30,13 @@ describe(':setlocal', function()
|
|||||||
eq('0', get_num_option_global('imsearch'))
|
eq('0', get_num_option_global('imsearch'))
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
describe(':set validation', function()
|
||||||
|
before_each(clear)
|
||||||
|
|
||||||
|
it('setlocal and setglobal validate values', function()
|
||||||
|
should_fail('shiftwidth', -10, 'E487')
|
||||||
|
should_fail('tabstop', -10, 'E487')
|
||||||
|
should_fail('winheight', -10, 'E487')
|
||||||
|
end)
|
||||||
|
end)
|
||||||
Reference in New Issue
Block a user