From 5d1cb73e7f17c29fc9e68ba293f63d8f8e71c264 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Sep 2022 12:07:16 +0800 Subject: vim-patch:8.2.0712: various code not fully tested Problem: Various code not fully tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes vim/vim#6049) https://github.com/vim/vim/commit/0ff5dedf0f69e56320199db7a2aad46be2a1f9b7 Nvim does not support encoding=latin1 or setting keycodes/termcaps. --- src/nvim/testdir/test_options.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/testdir/test_options.vim') diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index f11f3055f0..ec02f1f9da 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -282,6 +282,15 @@ func Test_set_completion() call feedkeys(":set fileencodings:\\\"\", 'tx') call assert_equal('"set fileencodings:ucs-bom,utf-8,default,latin1', @:) + " Expand key codes. + " call feedkeys(":set \\"\", 'tx') + " call assert_equal('"set ', @:) + + " Expand terminal options. + " call feedkeys(":set t_A\\\"\", 'tx') + " call assert_equal('"set t_AB t_AF t_AU t_AL', @:) + " call assert_fails('call feedkeys(":set =\\", "xt")', 'E474:') + " Expand directories. call feedkeys(":set cdpath=./\\\"\", 'tx') call assert_match('./samples/ ', @:) -- cgit From dd2b7586f36ab10232d9024ddf2dfb436518269e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Sep 2022 10:48:46 +0800 Subject: vim-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 vim/vim#8369) https://github.com/vim/vim/commit/5958549760652c173b703613b9cbf09b25a4eddb --- src/nvim/testdir/test_options.vim | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/nvim/testdir/test_options.vim') diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index ec02f1f9da..b19882a2cc 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -418,6 +418,7 @@ func Test_set_errors() set nomodifiable call assert_fails('set fileencoding=latin1', 'E21:') set modifiable& + " call assert_fails('set t_#-&', 'E522:') endfunc func CheckWasSet(name) @@ -932,6 +933,18 @@ func Test_opt_local_to_global() 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 @@ -1082,6 +1095,25 @@ func Test_opt_reset_scroll() call delete('Xscroll') endfunc +" Test for setting an option to a Vi or Vim default +func Test_opt_default() + throw 'Skipped: Nvim has different defaults' + 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 + " Test for the 'cdhome' option func Test_opt_cdhome() if has('unix') || has('vms') -- cgit From 88099c11223398b2e7eb96eaa9385d24046db994 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Sep 2022 11:17:41 +0800 Subject: vim-patch:8.2.2994: various code is not fully tested Problem: Various code is not fully tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes vim/vim#8378) https://github.com/vim/vim/commit/2d6d718dde7163c971d37b8f4f1ed8f2d25de130 Nvim does not support encoding=latin1 or compatible mode. The two paste tests are applicable. --- src/nvim/testdir/test_options.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/nvim/testdir/test_options.vim') diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index b19882a2cc..f49d2cdf33 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -1114,6 +1114,23 @@ func Test_cmdheight() set cmdheight& endfunc +" To specify a control character as a option value, '^' can be used +func Test_opt_control_char() + set wildchar=^v + call assert_equal("\", nr2char(&wildchar)) + set wildcharm=^r + call assert_equal("\", nr2char(&wildcharm)) + " Bug: This doesn't work for the 'cedit' and 'termwinkey' options + set wildchar& wildcharm& +endfunc + +" Test for the 'errorbells' option +func Test_opt_errorbells() + set errorbells + call assert_beeps('s/a1b2/x1y2/') + set noerrorbells +endfunc + " Test for the 'cdhome' option func Test_opt_cdhome() if has('unix') || has('vms') -- cgit From 800cda21641dab2411c23a95d85ecef2c731d550 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Sep 2022 11:15:35 +0800 Subject: vim-patch:8.2.3155: some option related code not covered by tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Some option related code not covered by tests. Solution: Add a few test cases. (Dominique Pellé, closes vim/vim#8552) https://github.com/vim/vim/commit/042414fa0053388f9a35cad61886405507554068 --- src/nvim/testdir/test_options.vim | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'src/nvim/testdir/test_options.vim') diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index f49d2cdf33..952975df32 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -947,6 +947,28 @@ func Test_opt_local_to_global() set autoread& endfunc +func Test_set_in_sandbox() + " Some boolean options cannot be set in sandbox, some can. + call assert_fails('sandbox set modelineexpr', 'E48:') + sandbox set number + call assert_true(&number) + set number& + + " Some boolean options cannot be set in sandbox, some can. + if has('python') || has('python3') + call assert_fails('sandbox set pyxversion=3', 'E48:') + endif + sandbox set tabstop=4 + call assert_equal(4, &tabstop) + set tabstop& + + " Some string options cannot be set in sandbox, some can. + call assert_fails('sandbox set backupdir=/tmp', 'E48:') + sandbox set filetype=perl + call assert_equal('perl', &filetype) + set filetype& +endfunc + " Test for incrementing, decrementing and multiplying a number option value func Test_opt_num_op() set shiftwidth=4 @@ -1131,6 +1153,28 @@ func Test_opt_errorbells() set noerrorbells endfunc +func Test_opt_scrolljump() + help + resize 10 + + " Test with positive 'scrolljump'. + set scrolljump=2 + norm! Lj + call assert_equal({'lnum':11, 'leftcol':0, 'col':0, 'topfill':0, + \ 'topline':3, 'coladd':0, 'skipcol':0, 'curswant':0}, + \ winsaveview()) + + " Test with negative 'scrolljump' (percentage of window height). + set scrolljump=-40 + norm! ggLj + call assert_equal({'lnum':11, 'leftcol':0, 'col':0, 'topfill':0, + \ 'topline':5, 'coladd':0, 'skipcol':0, 'curswant':0}, + \ winsaveview()) + + set scrolljump& + bw +endfunc + " Test for the 'cdhome' option func Test_opt_cdhome() if has('unix') || has('vms') -- cgit