aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2021-08-17 21:30:58 -0600
committerGregory Anders <greg@gpanders.com>2021-08-18 12:17:12 -0600
commitd8ab8cccd0cf5acdf3e7c3ca229cad4160a6fc2e (patch)
tree051f9f743f3786de6997f7f1f8e88e1ee6d8bcc5
parentd417e67e595a9eb19797866e91bb80b4fe299a94 (diff)
downloadrneovim-d8ab8cccd0cf5acdf3e7c3ca229cad4160a6fc2e.tar.gz
rneovim-d8ab8cccd0cf5acdf3e7c3ca229cad4160a6fc2e.tar.bz2
rneovim-d8ab8cccd0cf5acdf3e7c3ca229cad4160a6fc2e.zip
test: update tests to work with 'hidden'
-rw-r--r--src/nvim/testdir/test42.inbin2373 -> 2387 bytes
-rw-r--r--src/nvim/testdir/test_autocmd.vim1
-rw-r--r--src/nvim/testdir/test_command_count.vim2
-rw-r--r--src/nvim/testdir/test_diffmode.vim4
-rw-r--r--src/nvim/testdir/test_gf.vim2
-rw-r--r--src/nvim/testdir/test_ins_complete.vim2
-rw-r--r--src/nvim/testdir/test_join.vim4
-rw-r--r--src/nvim/testdir/test_mksession.vim2
-rw-r--r--src/nvim/testdir/test_options.vim2
-rw-r--r--src/nvim/testdir/test_tagjump.vim2
-rw-r--r--src/nvim/testdir/test_window_cmd.vim2
-rw-r--r--test/functional/api/buffer_updates_spec.lua10
-rw-r--r--test/functional/api/window_spec.lua3
-rw-r--r--test/functional/eval/buf_functions_spec.lua10
-rw-r--r--test/functional/ex_cmds/quickfix_commands_spec.lua1
-rw-r--r--test/functional/legacy/007_ball_buffer_list_spec.lua5
-rw-r--r--test/functional/legacy/008_autocommands_spec.lua3
-rw-r--r--test/functional/legacy/011_autocommands_spec.lua4
-rw-r--r--test/functional/legacy/012_directory_spec.lua1
-rw-r--r--test/functional/legacy/arglist_spec.lua2
-rw-r--r--test/functional/legacy/cdo_spec.lua4
-rw-r--r--test/functional/legacy/fixeol_spec.lua4
-rw-r--r--test/functional/plugin/shada_spec.lua6
-rw-r--r--test/functional/ui/float_spec.lua3
-rw-r--r--test/functional/ui/tabline_spec.lua1
25 files changed, 48 insertions, 32 deletions
diff --git a/src/nvim/testdir/test42.in b/src/nvim/testdir/test42.in
index d9057e72fb..456f9ddb07 100644
--- a/src/nvim/testdir/test42.in
+++ b/src/nvim/testdir/test42.in
Binary files differ
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
index c8138e5ca9..015979e1be 100644
--- a/src/nvim/testdir/test_autocmd.vim
+++ b/src/nvim/testdir/test_autocmd.vim
@@ -998,6 +998,7 @@ func Test_bufunload_all()
endfunc
au BufUnload * call UnloadAllBufs()
au VimLeave * call writefile(['Test Finished'], 'Xout')
+ set nohidden
edit Xxx1
split Xxx2
q
diff --git a/src/nvim/testdir/test_command_count.vim b/src/nvim/testdir/test_command_count.vim
index 55b230373f..c7dddf4164 100644
--- a/src/nvim/testdir/test_command_count.vim
+++ b/src/nvim/testdir/test_command_count.vim
@@ -33,7 +33,7 @@ func Test_command_count_0()
delcommand RangeBuffers
delcommand RangeBuffersAll
- set hidden&
+ set nohidden
set swapfile&
endfunc
diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim
index 5c9c1ce884..f39cda7663 100644
--- a/src/nvim/testdir/test_diffmode.vim
+++ b/src/nvim/testdir/test_diffmode.vim
@@ -540,7 +540,7 @@ func Test_diffopt_hiddenoff()
bwipe!
bwipe!
- set hidden& diffopt&
+ set nohidden diffopt&
endfunc
func Test_diffoff_hidden()
@@ -577,7 +577,7 @@ func Test_diffoff_hidden()
bwipe!
bwipe!
- set hidden& diffopt&
+ set nohidden diffopt&
endfunc
func Test_setting_cursor()
diff --git a/src/nvim/testdir/test_gf.vim b/src/nvim/testdir/test_gf.vim
index ee548037ba..43efd6248e 100644
--- a/src/nvim/testdir/test_gf.vim
+++ b/src/nvim/testdir/test_gf.vim
@@ -145,7 +145,7 @@ func Test_gf_visual()
bwipe!
call delete('Xtest_gf_visual')
- set hidden&
+ set nohidden
endfunc
func Test_gf_error()
diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim
index 3da3648fec..0fb026f6b0 100644
--- a/src/nvim/testdir/test_ins_complete.vim
+++ b/src/nvim/testdir/test_ins_complete.vim
@@ -95,7 +95,7 @@ func Test_ins_complete()
call delete('Xtest11.one')
call delete('Xtest11.two')
call delete('Xtestdata')
- set cpt& cot& def& tags& tagbsearch& hidden&
+ set cpt& cot& def& tags& tagbsearch& nohidden
cd ..
call delete('Xdir', 'rf')
endfunc
diff --git a/src/nvim/testdir/test_join.vim b/src/nvim/testdir/test_join.vim
index cdb0562756..ecb969d10a 100644
--- a/src/nvim/testdir/test_join.vim
+++ b/src/nvim/testdir/test_join.vim
@@ -35,7 +35,6 @@ endfunc
" Tests for setting the '[,'] marks when joining lines.
func Test_join_marks()
- set joinspaces
enew
call append(0, [
\ "\t\tO sodales, ludite, vos qui",
@@ -52,9 +51,8 @@ func Test_join_marks()
/^This line/;'}-join
call assert_equal([0, 4, 11, 0], getpos("'["))
- call assert_equal([0, 4, 67, 0], getpos("']"))
+ call assert_equal([0, 4, 66, 0], getpos("']"))
enew!
- set nojoinspaces
endfunc
" Test for joining lines and marks in them
diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim
index fbe764bbf2..c96c6a9678 100644
--- a/src/nvim/testdir/test_mksession.vim
+++ b/src/nvim/testdir/test_mksession.vim
@@ -307,7 +307,7 @@ func Test_mksession_buffer_count()
call delete('Xbaz')
call delete('Xtest_mks.out')
%bwipe!
- set hidden&
+ set nohidden
endfunc
if has('extra_search')
diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim
index 8796af7a20..72c151142d 100644
--- a/src/nvim/testdir/test_options.vim
+++ b/src/nvim/testdir/test_options.vim
@@ -539,7 +539,7 @@ func Test_copy_winopt()
call assert_equal(4,&numberwidth)
bw!
- set hidden&
+ set nohidden
endfunc
func Test_shortmess_F()
diff --git a/src/nvim/testdir/test_tagjump.vim b/src/nvim/testdir/test_tagjump.vim
index 68dcfb6890..b6d9143bc9 100644
--- a/src/nvim/testdir/test_tagjump.vim
+++ b/src/nvim/testdir/test_tagjump.vim
@@ -170,7 +170,7 @@ func Test_tag_symbolic()
call assert_equal('Xtest.c', expand('%:t'))
call assert_equal(2, col('.'))
- set hidden&
+ set nohidden
set tags&
enew!
call delete('Xtags')
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index a522705238..039de0c623 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -608,7 +608,7 @@ func Test_window_prevwin()
" reset
q
call delete('tmp.txt')
- set hidden&vim autoread&vim
+ set nohidden autoread&vim
delfunc Fun_RenewFile
endfunc
diff --git a/test/functional/api/buffer_updates_spec.lua b/test/functional/api/buffer_updates_spec.lua
index 05ca0d5f4d..c9c9be5406 100644
--- a/test/functional/api/buffer_updates_spec.lua
+++ b/test/functional/api/buffer_updates_spec.lua
@@ -159,9 +159,8 @@ describe('API: buffer events:', function()
tick = tick + 1
expectn('nvim_buf_lines_event', {b, tick, 29, 29, firstfour, false})
- -- create a new empty buffer and wipe out the old one ... this will
- -- turn off buffer events
- command('enew!')
+ -- delete the current buffer to turn off buffer events
+ command('bdelete!')
expectn('nvim_buf_detach_event', {b})
-- add a line at the start of an empty file
@@ -269,7 +268,7 @@ describe('API: buffer events:', function()
'original foo'}, false})
-- type text into the first line of a blank file, one character at a time
- command('enew!')
+ command('bdelete!')
tick = 2
expectn('nvim_buf_detach_event', {b})
local bnew = nvim('get_current_buf')
@@ -666,7 +665,8 @@ describe('API: buffer events:', function()
tick = tick + 1
expectn('nvim_buf_changedtick_event', {b, tick})
- -- close our buffer by creating a new one
+ -- close our buffer and create a new one
+ command('bdelete')
command('enew')
expectn('nvim_buf_detach_event', {b})
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index bb72b63b6c..e4aa1dae8e 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -311,7 +311,8 @@ describe('API/win', function()
eq({newwin}, meths.list_wins())
end)
- it('handles changed buffer', function()
+ it("handles changed buffer when 'hidden' is unset", function()
+ command('set nohidden')
local oldwin = meths.get_current_win()
insert('text')
command('new')
diff --git a/test/functional/eval/buf_functions_spec.lua b/test/functional/eval/buf_functions_spec.lua
index 06841a4521..e957e5f5af 100644
--- a/test/functional/eval/buf_functions_spec.lua
+++ b/test/functional/eval/buf_functions_spec.lua
@@ -221,9 +221,9 @@ describe('getbufvar() function', function()
eq(0, funcs.getbufvar(1, '&l:autoindent'))
eq(0, funcs.getbufvar(1, '&g:autoindent'))
-- Also works with global-only options
- eq(0, funcs.getbufvar(1, '&hidden'))
- eq(0, funcs.getbufvar(1, '&l:hidden'))
- eq(0, funcs.getbufvar(1, '&g:hidden'))
+ eq(1, funcs.getbufvar(1, '&hidden'))
+ eq(1, funcs.getbufvar(1, '&l:hidden'))
+ eq(1, funcs.getbufvar(1, '&g:hidden'))
-- Also works with window-local options
eq(0, funcs.getbufvar(1, '&number'))
eq(0, funcs.getbufvar(1, '&l:number'))
@@ -279,9 +279,9 @@ describe('setbufvar() function', function()
eq(false, winmeths.get_option(windows[3], 'number'))
eq(false, winmeths.get_option(meths.get_current_win(), 'number'))
- eq(false, meths.get_option('hidden'))
- funcs.setbufvar(1, '&hidden', true)
eq(true, meths.get_option('hidden'))
+ funcs.setbufvar(1, '&hidden', 0)
+ eq(false, meths.get_option('hidden'))
eq(false, bufmeths.get_option(buf1, 'autoindent'))
funcs.setbufvar(1, '&autoindent', true)
diff --git a/test/functional/ex_cmds/quickfix_commands_spec.lua b/test/functional/ex_cmds/quickfix_commands_spec.lua
index 06dafa9ab9..c956a2df2d 100644
--- a/test/functional/ex_cmds/quickfix_commands_spec.lua
+++ b/test/functional/ex_cmds/quickfix_commands_spec.lua
@@ -47,6 +47,7 @@ for _, c in ipairs({'l', 'c'}) do
eq(('%s-2.res'):format(file), funcs.bufname(list[2].bufnr))
-- Run cfile/lfile from a modified buffer
+ command('set nohidden')
command('enew!')
curbufmeths.set_lines(1, 1, true, {'Quickfix'})
eq(('Vim(%s):E37: No write since last change (add ! to override)'):format(
diff --git a/test/functional/legacy/007_ball_buffer_list_spec.lua b/test/functional/legacy/007_ball_buffer_list_spec.lua
index a180e73301..d4e4547c43 100644
--- a/test/functional/legacy/007_ball_buffer_list_spec.lua
+++ b/test/functional/legacy/007_ball_buffer_list_spec.lua
@@ -8,6 +8,9 @@ describe(':ball', function()
setup(clear)
it('is working', function()
+ -- Must disable 'hidden' so that the BufReadPost autocmd is triggered
+ -- when Xxx2 is reloaded
+ feed_command('set nohidden')
insert([[
start of test file Xxx
this is a test
@@ -18,7 +21,7 @@ describe(':ball', function()
feed('gg')
-- Write test file Xxx1
- feed('A1:.,/end of/w! Xxx1<cr>')
+ feed('A1<esc>:.,/end of/w! Xxx1<cr>')
feed_command('sp Xxx1')
feed_command('close')
diff --git a/test/functional/legacy/008_autocommands_spec.lua b/test/functional/legacy/008_autocommands_spec.lua
index 939404cb5e..002f037d09 100644
--- a/test/functional/legacy/008_autocommands_spec.lua
+++ b/test/functional/legacy/008_autocommands_spec.lua
@@ -71,6 +71,9 @@ describe('autocommands that delete and unload buffers:', function()
au BufUnload * call CloseAll()
au VimLeave * call WriteToOut()
]])
+ -- Must disable 'hidden' so that the BufUnload autocmd is triggered between
+ -- each :edit
+ command('set nohidden')
command('silent! edit Xxx2')
command('silent! edit Xxx1')
command('silent! edit Makefile') -- an existing file
diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua
index 7b6f2f63e9..0fa9290f3c 100644
--- a/test/functional/legacy/011_autocommands_spec.lua
+++ b/test/functional/legacy/011_autocommands_spec.lua
@@ -129,13 +129,11 @@ describe('file reading, writing and bufnew and filter autocommands', function()
-- Will load Xtest.c.
feed_command('e! foo.c')
feed_command("au FileAppendPre *.out '[,']s/new/NEW/")
- feed_command('au FileAppendPost *.out !cat Xtest.c >>test.out')
+ feed_command('au FileAppendPost *.out !cat Xtest.c >test.out')
-- Append it to the output file.
feed_command('w>>test.out')
-- Discard all prompts and messages.
feed('<C-L>')
- -- Expect the decompressed file in the buffer.
- feed_command('e test.out')
expect([[
/*
diff --git a/test/functional/legacy/012_directory_spec.lua b/test/functional/legacy/012_directory_spec.lua
index 48dd24db9e..f666e51469 100644
--- a/test/functional/legacy/012_directory_spec.lua
+++ b/test/functional/legacy/012_directory_spec.lua
@@ -80,6 +80,7 @@ describe("'directory' option", function()
eq({ "Xtest1.swp", "Xtest3" }, ls_dir_sorted("Xtest2"))
meths.set_option('directory', 'Xtest.je')
+ command('bdelete')
command('edit Xtest2/Xtest3')
eq(true, curbufmeths.get_option('swapfile'))
poke_eventloop()
diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua
index 67c5750033..6a2e86ccb4 100644
--- a/test/functional/legacy/arglist_spec.lua
+++ b/test/functional/legacy/arglist_spec.lua
@@ -156,10 +156,12 @@ describe('argument list commands', function()
eq({'a', 'b', 'a', 'c'}, eval('argv()'))
command('0argedit x')
eq({'x', 'a', 'b', 'a', 'c'}, eval('argv()'))
+ command('set nohidden')
command('enew! | set modified')
assert_fails('argedit y', 'E37:')
command('argedit! y')
eq({'x', 'y', 'y', 'a', 'b', 'a', 'c'}, eval('argv()'))
+ command('set hidden')
command('%argd')
command('argedit a b')
eq({'a', 'b'}, eval('argv()'))
diff --git a/test/functional/legacy/cdo_spec.lua b/test/functional/legacy/cdo_spec.lua
index 5e46431cc1..8b3216cbfd 100644
--- a/test/functional/legacy/cdo_spec.lua
+++ b/test/functional/legacy/cdo_spec.lua
@@ -91,7 +91,8 @@ describe('cdo', function()
exe "silent! 4,5" . XdoCmd
call assert_equal([], l)
- " Run commands from an unsaved buffer
+ " Run commands from an unsaved buffer when 'hidden' is unset
+ set nohidden
let v:errmsg=''
let l = []
enew
@@ -108,6 +109,7 @@ describe('cdo', function()
if subst_count != 1 || getline('.') != 'xLine1'
call add(v:errors, 'Abort command on error test failed')
endif
+ set hidden
let l = []
exe "2,2" . Xdo . "! call add(l, GetRuler())"
diff --git a/test/functional/legacy/fixeol_spec.lua b/test/functional/legacy/fixeol_spec.lua
index 50236e8617..d3ff86d349 100644
--- a/test/functional/legacy/fixeol_spec.lua
+++ b/test/functional/legacy/fixeol_spec.lua
@@ -23,8 +23,6 @@ describe('fixeol', function()
it('is working', function()
-- First write two test files – with and without trailing EOL.
- -- Use Unix fileformat for consistency.
- feed_command('set ff=unix')
feed_command('enew!')
feed('awith eol<esc>:w! XXEol<cr>')
feed_command('enew!')
@@ -40,7 +38,7 @@ describe('fixeol', function()
feed_command('e! XXNoEol')
feed('ostays without<esc>:set nofixeol<cr>')
feed_command('w! XXTestNoEol')
- feed_command('bwipe XXEol XXNoEol XXTestEol XXTestNoEol')
+ feed_command('bwipe! XXEol XXNoEol XXTestEol XXTestNoEol')
feed_command('set fixeol')
-- Append "END" to each file so that we can see what the last written char was.
diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua
index 5663f248bf..a4d78682ad 100644
--- a/test/functional/plugin/shada_spec.lua
+++ b/test/functional/plugin/shada_spec.lua
@@ -2161,6 +2161,12 @@ describe('plugin/shada.vim', function()
reset()
wshada('\004\000\009\147\000\196\002ab\196\001a')
wshada_tmp('\004\000\009\147\000\196\002ab\196\001b')
+
+ -- Need to set nohidden so that the buffer containing 'fname' is not unloaded
+ -- after loading 'fname_tmp', otherwise the '++opt not supported' test below
+ -- won't work since the BufReadCmd autocmd won't be triggered.
+ nvim_command('set nohidden')
+
nvim_command('edit ' .. fname)
eq({
'History entry with timestamp ' .. epoch .. ':',
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 51ee922d23..be22d9a403 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -74,7 +74,8 @@ describe('float window', function()
funcs.win_execute(win, 'bwipe!')
end)
- it('win_execute() call commands that not allowed' , function()
+ it("win_execute() call commands that are not allowed when 'hidden' is not set" , function()
+ command('set nohidden')
local buf = meths.create_buf(false, false)
meths.buf_set_lines(buf, 0, -1, true, {'the floatwin'})
local win = meths.open_win(buf, true, {relative='win', width=16, height=1, row=0, col=10})
diff --git a/test/functional/ui/tabline_spec.lua b/test/functional/ui/tabline_spec.lua
index ab8d63cda1..809486d4db 100644
--- a/test/functional/ui/tabline_spec.lua
+++ b/test/functional/ui/tabline_spec.lua
@@ -69,6 +69,7 @@ describe('ui/ext_tabline', function()
command("bnext")
local expected_buffers = {
+ {buffer = { id = 1 }, name = '[No Name]'},
{buffer = { id = 2 }, name = 'another-buffer'},
}
screen:expect{grid=[[