aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/lua/diagnostic_spec.lua34
-rw-r--r--test/functional/plugin/lsp/diagnostic_spec.lua4
-rw-r--r--test/functional/ui/popupmenu_spec.lua179
-rw-r--r--test/old/testdir/runtest.vim26
-rw-r--r--test/old/testdir/test_findfile.vim221
-rw-r--r--test/old/testdir/test_map_functions.vim19
-rw-r--r--test/old/testdir/test_modeline.vim1
-rw-r--r--test/old/testdir/test_options.vim36
-rw-r--r--test/old/testdir/test_undo.vim3
9 files changed, 492 insertions, 31 deletions
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua
index 4ae1146703..eb1ac3e6a1 100644
--- a/test/functional/lua/diagnostic_spec.lua
+++ b/test/functional/lua/diagnostic_spec.lua
@@ -111,6 +111,19 @@ describe('vim.diagnostic', function()
{ details = true }
)
end
+
+ ---@param ns integer
+ function _G.get_underline_extmarks(ns)
+ ---@type integer
+ local underline_ns = vim.diagnostic.get_namespace(ns).user_data.underline_ns
+ return vim.api.nvim_buf_get_extmarks(
+ _G.diagnostic_bufnr,
+ underline_ns,
+ 0,
+ -1,
+ { details = true }
+ )
+ end
end)
exec_lua(function()
@@ -1813,6 +1826,21 @@ describe('vim.diagnostic', function()
_G.make_info('Info', 4, 4, 4, 4),
})
+ function _G.get_highest_underline_hl(severity_sort)
+ vim.diagnostic.config({
+ underline = true,
+ severity_sort = severity_sort,
+ })
+
+ local extmarks = _G.get_underline_extmarks(_G.diagnostic_ns)
+
+ table.sort(extmarks, function(a, b)
+ return a[4].priority > b[4].priority
+ end)
+
+ return extmarks[1][4].hl_group
+ end
+
function _G.get_virt_text_and_signs(severity_sort)
vim.diagnostic.config({
severity_sort = severity_sort,
@@ -1864,6 +1892,12 @@ describe('vim.diagnostic', function()
result = exec_lua [[return _G.get_virt_text_and_signs({ reverse = true })]]
eq({ 'Error', 'Warn', 'Info' }, result[1])
eq({ 'Info', 'Warn', 'Error' }, result[2])
+
+ local underline_hl = exec_lua [[return _G.get_highest_underline_hl(true)]]
+ eq('DiagnosticUnderlineError', underline_hl)
+
+ underline_hl = exec_lua [[return _G.get_highest_underline_hl({ reverse = true })]]
+ eq('DiagnosticUnderlineInfo', underline_hl)
end)
it('can show diagnostic sources in virtual text', function()
diff --git a/test/functional/plugin/lsp/diagnostic_spec.lua b/test/functional/plugin/lsp/diagnostic_spec.lua
index 78c684083b..b7e292cad0 100644
--- a/test/functional/plugin/lsp/diagnostic_spec.lua
+++ b/test/functional/plugin/lsp/diagnostic_spec.lua
@@ -219,13 +219,13 @@ describe('vim.lsp.diagnostic', function()
eq(1, #result)
eq(
exec_lua(function()
- return vim.str_byteindex(line, 7, true)
+ return vim.str_byteindex(line, 'utf-16', 7)
end),
result[1].col
)
eq(
exec_lua(function()
- return vim.str_byteindex(line, 8, true)
+ return vim.str_byteindex(line, 'utf-16', 8)
end),
result[1].end_col
)
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index f128bdc961..295d677aa0 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -4506,9 +4506,10 @@ describe('builtin popupmenu', function()
:let g:menustr = 'foo' |
]])
end
+ local no_menu_screen ---@type string|test.function.ui.screen.Expect
if multigrid then
api.nvim_input_mouse('left', 'press', '', 4, 1, 2)
- screen:expect({
+ no_menu_screen = {
grid = [[
## grid 1
[2:--------------------------------]|*2
@@ -4527,19 +4528,189 @@ describe('builtin popupmenu', function()
{2:WINBAR }|
^popup menu test |
]],
- })
+ }
else
feed('<LeftMouse><31,2>')
- screen:expect([[
+ no_menu_screen = {
+ grid = [[
popup menu test |
{1:~ }|
{3:[No Name] [+] }|
popup menu test│{2:WINBAR }|
{1:~ }│^popup menu test |
:let g:menustr = 'bar' |
- ]])
+ ]],
+ }
end
+ screen:expect(no_menu_screen)
eq('bar', api.nvim_get_var('menustr'))
+
+ local no_sel_screen ---@type string|test.function.ui.screen.Expect
+ if multigrid then
+ no_sel_screen = {
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*2
+ {3:[No Name] [+] }|
+ [5:---------------]│[6:----------------]|*2
+ [3:--------------------------------]|
+ ## grid 2
+ popup menu test |
+ {1:~ }|
+ ## grid 3
+ :let g:menustr = 'bar' |
+ ## grid 4
+ {n: foo }|
+ {n: bar }|
+ {n: baz }|
+ ## grid 5
+ popup menu test|
+ {1:~ }|
+ ## grid 6
+ {2:WINBAR }|
+ ^popup menu test |
+ ]],
+ float_pos = { [4] = { -1, 'NW', 1, 1, 19, false, 250 } },
+ }
+ else
+ no_sel_screen = {
+ grid = [[
+ popup menu test |
+ {1:~ }{n: foo }{1: }|
+ {3:[No Name] [+] }{n: bar }{3: }|
+ popup menu test│{2:WIN}{n: baz }{2: }|
+ {1:~ }│^popup menu test |
+ :let g:menustr = 'bar' |
+ ]],
+ }
+ end
+ local sel_screens = {} ---@type (string|test.function.ui.screen.Expect)[]
+ for i, s in ipairs({ 'foo', 'bar', 'baz' }) do
+ local sel_screen = vim.deepcopy(no_sel_screen)
+ local grid = assert(sel_screen.grid)
+ grid = grid:gsub(vim.pesc(('{n: %s }'):format(s)), ('{s: %s }'):format(s))
+ sel_screen.grid = grid
+ sel_screens[i] = sel_screen
+ end
+
+ command([[let g:menustr = '']])
+ local g = multigrid and 1 or 0
+
+ api.nvim_input_mouse('right', 'press', '', g, 0, 20)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 1, 19)
+ screen:expect(sel_screens[1])
+ api.nvim_input_mouse('move', '', '', g, 1, 18)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 2, 23)
+ screen:expect(sel_screens[2])
+ api.nvim_input_mouse('move', '', '', g, 2, 24)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 3, 19)
+ screen:expect(sel_screens[3])
+ api.nvim_input_mouse('left', 'press', '', g, 3, 18)
+ screen:expect(no_menu_screen)
+ eq('', api.nvim_get_var('menustr'))
+
+ command('wincmd t | set rightleft')
+ if multigrid then
+ no_menu_screen = {
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*2
+ {4:[No Name] [+] }|
+ [5:---------------]│[6:----------------]|*2
+ [3:--------------------------------]|
+ ## grid 2
+ tset unem pupo^p|
+ {1: ~}|
+ ## grid 3
+ :let g:menustr = 'bar' |
+ ## grid 5
+ popup menu test|
+ {1:~ }|
+ ## grid 6
+ {2:WINBAR }|
+ popup menu test |
+ ]],
+ }
+ else
+ no_menu_screen = {
+ grid = [[
+ tset unem pupo^p|
+ {1: ~}|
+ {4:[No Name] [+] }|
+ popup menu test│{2:WINBAR }|
+ {1:~ }│popup menu test |
+ :let g:menustr = 'bar' |
+ ]],
+ }
+ end
+ screen:expect(no_menu_screen)
+
+ if multigrid then
+ no_sel_screen = {
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*2
+ {4:[No Name] [+] }|
+ [5:---------------]│[6:----------------]|*2
+ [3:--------------------------------]|
+ ## grid 2
+ tset unem pupo^p|
+ {1: ~}|
+ ## grid 3
+ :let g:menustr = 'bar' |
+ ## grid 4
+ {n: oof }|
+ {n: rab }|
+ {n: zab }|
+ ## grid 5
+ popup menu test|
+ {1:~ }|
+ ## grid 6
+ {2:WINBAR }|
+ popup menu test |
+ ]],
+ float_pos = { [4] = { -1, 'NW', 1, 1, 17, false, 250 } },
+ }
+ else
+ no_sel_screen = {
+ grid = [[
+ tset unem pupo^p|
+ {1: }{n: oof }{1: ~}|
+ {4:[No Name] [+] }{n: rab }{4: }|
+ popup menu test│{2:W}{n: zab }{2: }|
+ {1:~ }│popup menu test |
+ :let g:menustr = 'bar' |
+ ]],
+ }
+ end
+ for i, s in ipairs({ 'oof', 'rab', 'zab' }) do
+ local sel_screen = vim.deepcopy(no_sel_screen)
+ local grid = assert(sel_screen.grid)
+ grid = grid:gsub(vim.pesc(('{n: %s }'):format(s)), ('{s: %s }'):format(s))
+ sel_screen.grid = grid
+ sel_screens[i] = sel_screen
+ end
+
+ api.nvim_input_mouse('right', 'press', '', g, 0, 20)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 1, 21)
+ screen:expect(sel_screens[1])
+ api.nvim_input_mouse('move', '', '', g, 1, 22)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 2, 17)
+ screen:expect(sel_screens[2])
+ api.nvim_input_mouse('move', '', '', g, 2, 16)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 3, 21)
+ screen:expect(sel_screens[3])
+ api.nvim_input_mouse('left', 'press', '', g, 3, 22)
+ screen:expect(no_menu_screen)
+ eq('', api.nvim_get_var('menustr'))
+
+ command('set norightleft')
end)
if not multigrid then
diff --git a/test/old/testdir/runtest.vim b/test/old/testdir/runtest.vim
index e05a78e9ca..058635c332 100644
--- a/test/old/testdir/runtest.vim
+++ b/test/old/testdir/runtest.vim
@@ -174,10 +174,6 @@ func GetAllocId(name)
return lnum - top - 1
endfunc
-if has('reltime')
- let g:func_start = reltime()
-endif
-
" Get the list of swap files in the current directory.
func s:GetSwapFileList()
let save_dir = &directory
@@ -567,6 +563,16 @@ for g:testfunc in sort(s:tests)
" A test can set g:test_is_flaky to retry running the test.
let g:test_is_flaky = 0
+ " A test can set g:max_run_nr to change the max retry count.
+ let g:max_run_nr = 5
+ if has('mac')
+ let g:max_run_nr = 10
+ endif
+
+ " By default, give up if the same error occurs. A test can set
+ " g:giveup_same_error to 0 to not give up on the same error and keep trying.
+ let g:giveup_same_error = 1
+
let starttime = strftime("%H:%M:%S")
call RunTheTest(g:testfunc)
@@ -582,10 +588,15 @@ for g:testfunc in sort(s:tests)
call extend(s:messages, v:errors)
let endtime = strftime("%H:%M:%S")
- call add(total_errors, $'Run {g:run_nr}, {starttime} - {endtime}:')
+ if has('reltime')
+ let suffix = $' in{reltimestr(reltime(g:func_start))} seconds'
+ else
+ let suffix = ''
+ endif
+ call add(total_errors, $'Run {g:run_nr}, {starttime} - {endtime}{suffix}:')
call extend(total_errors, v:errors)
- if g:run_nr >= 5 || prev_error == v:errors[0]
+ if g:run_nr >= g:max_run_nr || g:giveup_same_error && prev_error == v:errors[0]
call add(total_errors, 'Flaky test failed too often, giving up')
let v:errors = total_errors
break
@@ -596,7 +607,8 @@ for g:testfunc in sort(s:tests)
" Flakiness is often caused by the system being very busy. Sleep a
" couple of seconds to have a higher chance of succeeding the second
" time.
- sleep 2
+ let delay = g:run_nr * 2
+ exe 'sleep' delay
let prev_error = v:errors[0]
let v:errors = []
diff --git a/test/old/testdir/test_findfile.vim b/test/old/testdir/test_findfile.vim
index 06d781ed69..d3fdcad045 100644
--- a/test/old/testdir/test_findfile.vim
+++ b/test/old/testdir/test_findfile.vim
@@ -1,5 +1,7 @@
" Test findfile() and finddir()
+source check.vim
+
let s:files = [ 'Xfinddir1/foo',
\ 'Xfinddir1/bar',
\ 'Xfinddir1/Xdir2/foo',
@@ -286,4 +288,223 @@ func Test_find_non_existing_path()
let &path = save_path
endfunc
+" Test for 'findexpr'
+func Test_findexpr()
+ CheckUnix
+ call assert_equal('', &findexpr)
+ call writefile(['aFile'], 'Xfindexpr1.c', 'D')
+ call writefile(['bFile'], 'Xfindexpr2.c', 'D')
+ call writefile(['cFile'], 'Xfindexpr3.c', 'D')
+
+ " basic tests
+ func FindExpr1()
+ let fnames = ['Xfindexpr1.c', 'Xfindexpr2.c', 'Xfindexpr3.c']
+ return fnames->copy()->filter('v:val =~? v:fname')
+ endfunc
+
+ set findexpr=FindExpr1()
+ find Xfindexpr3
+ call assert_match('Xfindexpr3.c', @%)
+ bw!
+ 2find Xfind
+ call assert_match('Xfindexpr2.c', @%)
+ bw!
+ call assert_fails('4find Xfind', 'E347: No more file "Xfind" found in path')
+ call assert_fails('find foobar', 'E345: Can''t find file "foobar" in path')
+
+ sfind Xfindexpr2.c
+ call assert_match('Xfindexpr2.c', @%)
+ call assert_equal(2, winnr('$'))
+ %bw!
+ call assert_fails('sfind foobar', 'E345: Can''t find file "foobar" in path')
+
+ tabfind Xfindexpr3.c
+ call assert_match('Xfindexpr3.c', @%)
+ call assert_equal(2, tabpagenr())
+ %bw!
+ call assert_fails('tabfind foobar', 'E345: Can''t find file "foobar" in path')
+
+ " Buffer-local option
+ set findexpr=['abc']
+ new
+ setlocal findexpr=['def']
+ find xxxx
+ call assert_equal('def', @%)
+ wincmd w
+ find xxxx
+ call assert_equal('abc', @%)
+ aboveleft new
+ call assert_equal("['abc']", &findexpr)
+ wincmd k
+ aboveleft new
+ call assert_equal("['abc']", &findexpr)
+ %bw!
+
+ " Empty list
+ set findexpr=[]
+ call assert_fails('find xxxx', 'E345: Can''t find file "xxxx" in path')
+
+ " Error cases
+
+ " Syntax error in the expression
+ set findexpr=FindExpr1{}
+ call assert_fails('find Xfindexpr1.c', 'E15: Invalid expression')
+
+ " Find expression throws an error
+ func FindExpr2()
+ throw 'find error'
+ endfunc
+ set findexpr=FindExpr2()
+ call assert_fails('find Xfindexpr1.c', 'find error')
+
+ " Try using a null List as the expression
+ set findexpr=v:_null_list
+ call assert_fails('find Xfindexpr1.c', 'E345: Can''t find file "Xfindexpr1.c" in path')
+
+ " Try to create a new window from the find expression
+ func FindExpr3()
+ new
+ return ["foo"]
+ endfunc
+ set findexpr=FindExpr3()
+ call assert_fails('find Xfindexpr1.c', 'E565: Not allowed to change text or change window')
+
+ " Try to modify the current buffer from the find expression
+ func FindExpr4()
+ call setline(1, ['abc'])
+ return ["foo"]
+ endfunc
+ set findexpr=FindExpr4()
+ call assert_fails('find Xfindexpr1.c', 'E565: Not allowed to change text or change window')
+
+ " Expression returning a string
+ set findexpr='abc'
+ call assert_fails('find Xfindexpr1.c', "E1514: 'findexpr' did not return a List type")
+
+ set findexpr&
+ delfunc! FindExpr1
+ delfunc! FindExpr2
+ delfunc! FindExpr3
+ delfunc! FindExpr4
+endfunc
+
+" Test for using a script-local function for 'findexpr'
+func Test_findexpr_scriptlocal_func()
+ func! s:FindExprScript()
+ let g:FindExprArg = v:fname
+ return ['xxx']
+ endfunc
+
+ set findexpr=s:FindExprScript()
+ call assert_equal(expand('<SID>') .. 'FindExprScript()', &findexpr)
+ call assert_equal(expand('<SID>') .. 'FindExprScript()', &g:findexpr)
+ new | only
+ let g:FindExprArg = ''
+ find abc
+ call assert_equal('abc', g:FindExprArg)
+ bw!
+
+ set findexpr=<SID>FindExprScript()
+ call assert_equal(expand('<SID>') .. 'FindExprScript()', &findexpr)
+ call assert_equal(expand('<SID>') .. 'FindExprScript()', &g:findexpr)
+ new | only
+ let g:FindExprArg = ''
+ find abc
+ call assert_equal('abc', g:FindExprArg)
+ bw!
+
+ let &findexpr = 's:FindExprScript()'
+ call assert_equal(expand('<SID>') .. 'FindExprScript()', &g:findexpr)
+ new | only
+ let g:FindExprArg = ''
+ find abc
+ call assert_equal('abc', g:FindExprArg)
+ bw!
+
+ let &findexpr = '<SID>FindExprScript()'
+ call assert_equal(expand('<SID>') .. 'FindExprScript()', &g:findexpr)
+ new | only
+ let g:FindExprArg = ''
+ find abc
+ call assert_equal('abc', g:FindExprArg)
+ bw!
+
+ set findexpr=
+ setglobal findexpr=s:FindExprScript()
+ setlocal findexpr=
+ call assert_equal(expand('<SID>') .. 'FindExprScript()', &findexpr)
+ call assert_equal(expand('<SID>') .. 'FindExprScript()', &g:findexpr)
+ call assert_equal('', &l:findexpr)
+ new | only
+ let g:FindExprArg = ''
+ find abc
+ call assert_equal('abc', g:FindExprArg)
+ bw!
+
+ new | only
+ set findexpr=
+ setglobal findexpr=
+ setlocal findexpr=s:FindExprScript()
+ call assert_equal(expand('<SID>') .. 'FindExprScript()', &findexpr)
+ call assert_equal(expand('<SID>') .. 'FindExprScript()', &l:findexpr)
+ call assert_equal('', &g:findexpr)
+ let g:FindExprArg = ''
+ find abc
+ call assert_equal('abc', g:FindExprArg)
+ bw!
+
+ set findexpr=
+ delfunc s:FindExprScript
+endfunc
+
+" Test for expanding the argument to the :find command using 'findexpr'
+func Test_findexpr_expand_arg()
+ let s:fnames = ['Xfindexpr1.c', 'Xfindexpr2.c', 'Xfindexpr3.c']
+
+ " 'findexpr' that accepts a regular expression
+ func FindExprRegexp()
+ return s:fnames->copy()->filter('v:val =~? v:fname')
+ endfunc
+
+ " 'findexpr' that accepts a glob
+ func FindExprGlob()
+ let pat = glob2regpat(v:cmdcomplete ? $'*{v:fname}*' : v:fname)
+ return s:fnames->copy()->filter('v:val =~? pat')
+ endfunc
+
+ for regexp in [v:true, v:false]
+ let &findexpr = regexp ? 'FindExprRegexp()' : 'FindExprGlob()'
+
+ call feedkeys(":find \<Tab>\<C-B>\"\<CR>", "xt")
+ call assert_equal('"find Xfindexpr1.c', @:)
+
+ call feedkeys(":find Xfind\<Tab>\<Tab>\<C-B>\"\<CR>", "xt")
+ call assert_equal('"find Xfindexpr2.c', @:)
+
+ call assert_equal(s:fnames, getcompletion('find ', 'cmdline'))
+ call assert_equal(s:fnames, getcompletion('find Xfind', 'cmdline'))
+
+ let pat = regexp ? 'X.*1\.c' : 'X*1.c'
+ call feedkeys($":find {pat}\<Tab>\<C-B>\"\<CR>", "xt")
+ call assert_equal('"find Xfindexpr1.c', @:)
+ call assert_equal(['Xfindexpr1.c'], getcompletion($'find {pat}', 'cmdline'))
+
+ call feedkeys(":find 3\<Tab>\<C-B>\"\<CR>", "xt")
+ call assert_equal('"find Xfindexpr3.c', @:)
+ call assert_equal(['Xfindexpr3.c'], getcompletion($'find 3', 'cmdline'))
+
+ call feedkeys(":find Xfind\<C-A>\<C-B>\"\<CR>", "xt")
+ call assert_equal('"find Xfindexpr1.c Xfindexpr2.c Xfindexpr3.c', @:)
+
+ call feedkeys(":find abc\<Tab>\<C-B>\"\<CR>", "xt")
+ call assert_equal('"find abc', @:)
+ call assert_equal([], getcompletion('find abc', 'cmdline'))
+ endfor
+
+ set findexpr&
+ delfunc! FindExprRegexp
+ delfunc! FindExprGlob
+ unlet s:fnames
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/old/testdir/test_map_functions.vim b/test/old/testdir/test_map_functions.vim
index 8f7c8bae76..5118063b36 100644
--- a/test/old/testdir/test_map_functions.vim
+++ b/test/old/testdir/test_map_functions.vim
@@ -527,6 +527,25 @@ func Test_map_restore_negative_sid()
call delete('Xresult')
endfunc
+" Check that restoring a mapping doesn't remove a mapping whose {rhs} matches
+" the restored mapping's {lhs}.
+func Test_map_restore_with_rhs_match_lhs()
+ nnoremap <F2> <F3>
+ nnoremap <F3> <F4>
+ call assert_equal('<F3>', maparg('<F2>', 'n'))
+ call assert_equal('<F4>', maparg('<F3>', 'n'))
+ let d = maparg('<F3>', 'n', v:false, v:true)
+ nunmap <F3>
+ call assert_equal('<F3>', maparg('<F2>', 'n'))
+ call assert_equal('', maparg('<F3>', 'n'))
+ call mapset(d)
+ call assert_equal('<F3>', maparg('<F2>', 'n'))
+ call assert_equal('<F4>', maparg('<F3>', 'n'))
+
+ nunmap <F2>
+ nunmap <F3>
+endfunc
+
func Test_maplist()
new
func s:ClearMappingsAbbreviations()
diff --git a/test/old/testdir/test_modeline.vim b/test/old/testdir/test_modeline.vim
index 487a89e038..7b7163d372 100644
--- a/test/old/testdir/test_modeline.vim
+++ b/test/old/testdir/test_modeline.vim
@@ -217,6 +217,7 @@ func Test_modeline_fails_always()
call s:modeline_fails('equalprg', 'equalprg=Something()', 'E520:')
call s:modeline_fails('errorfile', 'errorfile=Something()', 'E520:')
call s:modeline_fails('exrc', 'exrc=Something()', 'E520:')
+ call s:modeline_fails('findexpr', 'findexpr=Something()', 'E520:')
call s:modeline_fails('formatprg', 'formatprg=Something()', 'E520:')
call s:modeline_fails('fsync', 'fsync=Something()', 'E520:')
call s:modeline_fails('grepprg', 'grepprg=Something()', 'E520:')
diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim
index ccc7abe2d8..6902560518 100644
--- a/test/old/testdir/test_options.vim
+++ b/test/old/testdir/test_options.vim
@@ -1386,7 +1386,8 @@ func Test_local_scrolloff()
call assert_equal(5, &so)
wincmd w
call assert_equal(3, &so)
- setlocal so<
+ "setlocal so<
+ set so<
call assert_equal(5, &so)
setglob so=8
call assert_equal(8, &so)
@@ -1403,7 +1404,8 @@ func Test_local_scrolloff()
call assert_equal(7, &siso)
wincmd w
call assert_equal(3, &siso)
- setlocal siso<
+ "setlocal siso<
+ set siso<
call assert_equal(7, &siso)
setglob siso=4
call assert_equal(4, &siso)
@@ -1557,7 +1559,7 @@ endfunc
" Test for changing options in a sandbox
func Test_opt_sandbox()
- for opt in ['backupdir', 'cdpath', 'exrc']
+ for opt in ['backupdir', 'cdpath', 'exrc', 'findexpr']
call assert_fails('sandbox set ' .. opt .. '?', 'E48:')
call assert_fails('sandbox let &' .. opt .. ' = 1', 'E48:')
endfor
@@ -1595,17 +1597,17 @@ func Test_set_number_global_local_option()
call assert_equal(12, &l:scrolloff)
call assert_equal(12, &scrolloff)
- " :set {option}< set the effective value of {option} to its global value.
- set scrolloff<
- " Nvim: local value is removed
- " call assert_equal(10, &l:scrolloff)
- call assert_equal(-1, &l:scrolloff)
+ " :setlocal {option}< set the effective value of {option} to its global value.
+ "set scrolloff<
+ setlocal scrolloff<
+ call assert_equal(10, &l:scrolloff)
call assert_equal(10, &scrolloff)
- " :setlocal {option}< removes the local value, so that the global value will be used.
+ " :set {option}< removes the local value, so that the global value will be used.
setglobal scrolloff=15
setlocal scrolloff=18
- setlocal scrolloff<
+ "setlocal scrolloff<
+ set scrolloff<
call assert_equal(-1, &l:scrolloff)
call assert_equal(15, &scrolloff)
@@ -1620,17 +1622,17 @@ func Test_set_boolean_global_local_option()
call assert_equal(0, &l:autoread)
call assert_equal(0, &autoread)
- " :set {option}< set the effective value of {option} to its global value.
- set autoread<
- " Nvim: local value is removed
- " call assert_equal(1, &l:autoread)
- call assert_equal(-1, &l:autoread)
+ " :setlocal {option}< set the effective value of {option} to its global value.
+ "set autoread<
+ setlocal autoread<
+ call assert_equal(1, &l:autoread)
call assert_equal(1, &autoread)
- " :setlocal {option}< removes the local value, so that the global value will be used.
+ " :set {option}< removes the local value, so that the global value will be used.
setglobal noautoread
setlocal autoread
- setlocal autoread<
+ "setlocal autoread<
+ set autoread<
call assert_equal(-1, &l:autoread)
call assert_equal(0, &autoread)
diff --git a/test/old/testdir/test_undo.vim b/test/old/testdir/test_undo.vim
index a207f4f4e0..d876277850 100644
--- a/test/old/testdir/test_undo.vim
+++ b/test/old/testdir/test_undo.vim
@@ -187,7 +187,8 @@ func Test_global_local_undolevels()
" Resetting the local 'undolevels' value to use the global value
setlocal undolevels=5
- setlocal undolevels<
+ "setlocal undolevels<
+ set undolevels<
call assert_equal(-123456, &l:undolevels)
" Drop created windows