patch 8.2.2979: not all options code is covered by tests
Problem: Not all options code is covered by tests.
Solution: Add more tests for options. (Yegappan Lakshmanan, closes #8369)
diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim
index d789a46..d640426 100644
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -434,6 +434,7 @@
set nomodifiable
call assert_fails('set fileencoding=latin1', 'E21:')
set modifiable&
+ call assert_fails('set t_#-&', 'E522:')
endfunc
func CheckWasSet(name)
@@ -946,6 +947,18 @@
call assert_equal('gnewprg', &l:equalprg)
call assert_equal('gnewprg', &equalprg)
set equalprg&
+
+ " Test for setting the global/local value of a boolean option
+ setglobal autoread
+ setlocal noautoread
+ call assert_false(&autoread)
+ set autoread<
+ call assert_true(&autoread)
+ setglobal noautoread
+ setlocal autoread
+ setlocal autoread<
+ call assert_false(&autoread)
+ set autoread&
endfunc
" Test for incrementing, decrementing and multiplying a number option value
@@ -1121,4 +1134,22 @@
call setenv('VIM_POSIX', saved_VIM_POSIX)
endfunc
+" Test for setting an option to a Vi or Vim default
+func Test_opt_default()
+ set formatoptions&vi
+ call assert_equal('vt', &formatoptions)
+ set formatoptions&vim
+ call assert_equal('tcq', &formatoptions)
+endfunc
+
+" Test for the 'cmdheight' option
+func Test_cmdheight()
+ %bw!
+ let ht = &lines
+ set cmdheight=9999
+ call assert_equal(1, winheight(0))
+ call assert_equal(ht - 1, &cmdheight)
+ set cmdheight&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab