aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/functional/options/num_options_spec.lua (renamed from test/functional/options/setlocal_setglobal_spec.lua)20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/functional/options/setlocal_setglobal_spec.lua b/test/functional/options/num_options_spec.lua
index 6902437403..c37bbeffc3 100644
--- a/test/functional/options/setlocal_setglobal_spec.lua
+++ b/test/functional/options/num_options_spec.lua
@@ -8,6 +8,16 @@ local function get_num_option_global(opt)
return nvim('command_output', 'setglobal ' .. opt .. '?'):match('%d+')
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()
before_each(clear)
@@ -20,3 +30,13 @@ describe(':setlocal', function()
eq('0', get_num_option_global('imsearch'))
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)