Mercurial > vim
comparison src/testdir/test_options.vim @ 19991:f27473034f26 v8.2.0551
patch 8.2.0551: not all code for options is tested
Commit: https://github.com/vim/vim/commit/1363a30cef382b912bf092969e040333c5c293c6
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 12 13:50:26 2020 +0200
patch 8.2.0551: not all code for options is tested
Problem: Not all code for options is tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5913)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Apr 2020 14:00:04 +0200 |
parents | b07672d13ff9 |
children | d13f8ae3b1de |
comparison
equal
deleted
inserted
replaced
19990:696d046d651b | 19991:f27473034f26 |
---|---|
267 call feedkeys(":set tags=./\<C-A>\<C-B>\"\<CR>", 'tx') | 267 call feedkeys(":set tags=./\<C-A>\<C-B>\"\<CR>", 'tx') |
268 call assert_match(' ./samples/.* ./small.vim', @:) | 268 call assert_match(' ./samples/.* ./small.vim', @:) |
269 | 269 |
270 call feedkeys(":set tags=./\\\\ dif\<C-A>\<C-B>\"\<CR>", 'tx') | 270 call feedkeys(":set tags=./\\\\ dif\<C-A>\<C-B>\"\<CR>", 'tx') |
271 call assert_equal('"set tags=./\\ diff diffexpr diffopt', @:) | 271 call assert_equal('"set tags=./\\ diff diffexpr diffopt', @:) |
272 | |
273 set tags& | 272 set tags& |
273 | |
274 " Expanding the option names | |
275 call feedkeys(":set \<Tab>\<C-B>\"\<CR>", 'xt') | |
276 call assert_equal('"set all', @:) | |
277 | |
278 " Expanding a second set of option names | |
279 call feedkeys(":set wrapscan \<Tab>\<C-B>\"\<CR>", 'xt') | |
280 call assert_equal('"set wrapscan all', @:) | |
281 | |
282 " Expanding a special keycode | |
283 call feedkeys(":set <Home>\<Tab>\<C-B>\"\<CR>", 'xt') | |
284 call assert_equal('"set <Home>', @:) | |
285 | |
286 " Expanding an invalid special keycode | |
287 call feedkeys(":set <abcd>\<Tab>\<C-B>\"\<CR>", 'xt') | |
288 call assert_equal("\"set <abcd>\<Tab>", @:) | |
289 | |
290 " Expanding a terminal keycode | |
291 call feedkeys(":set t_AB\<Tab>\<C-B>\"\<CR>", 'xt') | |
292 call assert_equal("\"set t_AB", @:) | |
293 | |
294 " Expanding an invalid option name | |
295 call feedkeys(":set abcde=\<Tab>\<C-B>\"\<CR>", 'xt') | |
296 call assert_equal("\"set abcde=\<Tab>", @:) | |
297 | |
298 " Expanding after a = for a boolean option | |
299 call feedkeys(":set wrapscan=\<Tab>\<C-B>\"\<CR>", 'xt') | |
300 call assert_equal("\"set wrapscan=\<Tab>", @:) | |
301 | |
302 " Expanding a numeric option | |
303 call feedkeys(":set tabstop+=\<Tab>\<C-B>\"\<CR>", 'xt') | |
304 call assert_equal("\"set tabstop+=" .. &tabstop, @:) | |
305 | |
306 " Expanding a non-boolean option | |
307 call feedkeys(":set invtabstop=\<Tab>\<C-B>\"\<CR>", 'xt') | |
308 call assert_equal("\"set invtabstop=", @:) | |
309 | |
310 " Expand options for 'spellsuggest' | |
311 call feedkeys(":set spellsuggest=best,file:xyz\<Tab>\<C-B>\"\<CR>", 'xt') | |
312 call assert_equal("\"set spellsuggest=best,file:xyz", @:) | |
313 | |
314 " Expand value for 'key' | |
315 set key=abcd | |
316 call feedkeys(":set key=\<Tab>\<C-B>\"\<CR>", 'xt') | |
317 call assert_equal('"set key=*****', @:) | |
318 set key= | |
274 endfunc | 319 endfunc |
275 | 320 |
276 func Test_set_errors() | 321 func Test_set_errors() |
277 call assert_fails('set scroll=-1', 'E49:') | 322 call assert_fails('set scroll=-1', 'E49:') |
278 call assert_fails('set backupcopy=', 'E474:') | 323 call assert_fails('set backupcopy=', 'E474:') |
325 if has('mouseshape') | 370 if has('mouseshape') |
326 call assert_fails('se mouseshape=i-r:x', 'E547:') | 371 call assert_fails('se mouseshape=i-r:x', 'E547:') |
327 endif | 372 endif |
328 call assert_fails('set backupext=~ patchmode=~', 'E589:') | 373 call assert_fails('set backupext=~ patchmode=~', 'E589:') |
329 call assert_fails('set winminheight=10 winheight=9', 'E591:') | 374 call assert_fails('set winminheight=10 winheight=9', 'E591:') |
375 set winminheight& winheight& | |
376 set winheight=10 winminheight=10 | |
377 call assert_fails('set winheight=9', 'E591:') | |
378 set winminheight& winheight& | |
330 call assert_fails('set winminwidth=10 winwidth=9', 'E592:') | 379 call assert_fails('set winminwidth=10 winwidth=9', 'E592:') |
380 set winminwidth& winwidth& | |
381 call assert_fails('set winwidth=9 winminwidth=10', 'E592:') | |
382 set winwidth& winminwidth& | |
331 call assert_fails("set showbreak=\x01", 'E595:') | 383 call assert_fails("set showbreak=\x01", 'E595:') |
332 call assert_fails('set t_foo=', 'E846:') | 384 call assert_fails('set t_foo=', 'E846:') |
333 call assert_fails('set tabstop??', 'E488:') | 385 call assert_fails('set tabstop??', 'E488:') |
334 call assert_fails('set wrapscan!!', 'E488:') | 386 call assert_fails('set wrapscan!!', 'E488:') |
335 call assert_fails('set tabstop&&', 'E488:') | 387 call assert_fails('set tabstop&&', 'E488:') |
336 call assert_fails('set wrapscan<<', 'E488:') | 388 call assert_fails('set wrapscan<<', 'E488:') |
337 call assert_fails('set wrapscan=1', 'E474:') | 389 call assert_fails('set wrapscan=1', 'E474:') |
338 call assert_fails('set autoindent@', 'E488:') | 390 call assert_fails('set autoindent@', 'E488:') |
339 call assert_fails('set wildchar=<abc>', 'E474:') | 391 call assert_fails('set wildchar=<abc>', 'E474:') |
340 call assert_fails('set cmdheight=1a', 'E521:') | 392 call assert_fails('set cmdheight=1a', 'E521:') |
393 call assert_fails('set invcmdheight', 'E474:') | |
341 if has('python') && has('python3') | 394 if has('python') && has('python3') |
342 call assert_fails('set pyxversion=6', 'E474:') | 395 call assert_fails('set pyxversion=6', 'E474:') |
343 endif | 396 endif |
397 call assert_fails("let &tabstop='ab'", 'E521:') | |
344 endfunc | 398 endfunc |
345 | 399 |
346 func CheckWasSet(name) | 400 func CheckWasSet(name) |
347 let verb_cm = execute('verbose set ' .. a:name .. '?') | 401 let verb_cm = execute('verbose set ' .. a:name .. '?') |
348 call assert_match('Last set from.*test_options.vim', verb_cm) | 402 call assert_match('Last set from.*test_options.vim', verb_cm) |
796 | 850 |
797 " Test for changing options in a sandbox | 851 " Test for changing options in a sandbox |
798 func Test_opt_sandbox() | 852 func Test_opt_sandbox() |
799 for opt in ['backupdir', 'cdpath', 'exrc'] | 853 for opt in ['backupdir', 'cdpath', 'exrc'] |
800 call assert_fails('sandbox set ' .. opt .. '?', 'E48:') | 854 call assert_fails('sandbox set ' .. opt .. '?', 'E48:') |
855 call assert_fails('sandbox let &' .. opt .. ' = 1', 'E48:') | |
801 endfor | 856 endfor |
857 call assert_fails('sandbox let &modelineexpr = 1', 'E48:') | |
802 endfunc | 858 endfunc |
803 | 859 |
804 " Test for setting an option with local value to global value | 860 " Test for setting an option with local value to global value |
805 func Test_opt_local_to_global() | 861 func Test_opt_local_to_global() |
806 setglobal equalprg=gprg | 862 setglobal equalprg=gprg |