mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.1224: still interference between test functions
Problem: Still interference between test functions.
Solution: Clear autocommands. Wipe all buffers. Fix tests that depend on a
specific start context.
cf1ba35fc2
This commit is contained in:
parent
348193f49c
commit
9b6ed6c71c
@ -4,7 +4,7 @@
|
|||||||
"
|
"
|
||||||
" To execute only specific test functions, add a second argument. It will be
|
" To execute only specific test functions, add a second argument. It will be
|
||||||
" matched against the names of the Test_ function. E.g.:
|
" matched against the names of the Test_ function. E.g.:
|
||||||
" ../vim -u NONE -S runtest.vim test_channel.vim open_delay
|
" ../vim -u NONE -S runtest.vim test_channel.vim open_delay
|
||||||
" The output can be found in the "messages" file.
|
" The output can be found in the "messages" file.
|
||||||
"
|
"
|
||||||
" The test script may contain anything, only functions that start with
|
" The test script may contain anything, only functions that start with
|
||||||
@ -83,6 +83,11 @@ endfunc
|
|||||||
|
|
||||||
func RunTheTest(test)
|
func RunTheTest(test)
|
||||||
echo 'Executing ' . a:test
|
echo 'Executing ' . a:test
|
||||||
|
|
||||||
|
" Some tests wipe out buffers. To be consistent, always wipe out all
|
||||||
|
" buffers.
|
||||||
|
%bwipe!
|
||||||
|
|
||||||
if exists("*SetUp")
|
if exists("*SetUp")
|
||||||
try
|
try
|
||||||
call SetUp()
|
call SetUp()
|
||||||
@ -110,9 +115,12 @@ func RunTheTest(test)
|
|||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Clear any autocommands
|
||||||
|
au!
|
||||||
|
|
||||||
" Close any extra tab pages and windows and make the current one not modified.
|
" Close any extra tab pages and windows and make the current one not modified.
|
||||||
while tabpagenr('$') > 1
|
while tabpagenr('$') > 1
|
||||||
bwipe!
|
quit!
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
while 1
|
while 1
|
||||||
@ -127,15 +135,6 @@ func RunTheTest(test)
|
|||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" Wipe out all buffers except the current one, then wipe the current one.
|
|
||||||
for nr in range(1, bufnr('$'))
|
|
||||||
if nr != bufnr('%') && bufexists(nr)
|
|
||||||
exe nr . 'bwipe!'
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
set nomodified
|
|
||||||
bwipe
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func AfterTheTest()
|
func AfterTheTest()
|
||||||
@ -214,8 +213,8 @@ endif
|
|||||||
|
|
||||||
" Names of flaky tests.
|
" Names of flaky tests.
|
||||||
let s:flaky = [
|
let s:flaky = [
|
||||||
\ 'Test_with_partial_callback()',
|
|
||||||
\ 'Test_oneshot()',
|
\ 'Test_oneshot()',
|
||||||
|
\ 'Test_with_partial_callback()',
|
||||||
\ 'Test_lambda_with_timer()',
|
\ 'Test_lambda_with_timer()',
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
" Tests for the getbufinfo(), getwininfo() and gettabinfo() functions
|
" Tests for the getbufinfo(), getwininfo() and gettabinfo() functions
|
||||||
|
|
||||||
function Test_getbufwintabinfo()
|
function Test_getbufwintabinfo()
|
||||||
1,$bwipeout
|
|
||||||
edit Xtestfile1
|
edit Xtestfile1
|
||||||
edit Xtestfile2
|
edit Xtestfile2
|
||||||
let buflist = getbufinfo()
|
let buflist = getbufinfo()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
" Test for user command counts.
|
" Test for user command counts.
|
||||||
|
|
||||||
func Test_command_count_0()
|
func Test_command_count_0()
|
||||||
|
let bufnr = bufnr('%')
|
||||||
set hidden
|
set hidden
|
||||||
set noswapfile
|
set noswapfile
|
||||||
|
|
||||||
@ -15,17 +16,17 @@ func Test_command_count_0()
|
|||||||
command! -range=% -addr=buffers RangeBuffersAll :let lines = [<line1>, <line2>]
|
command! -range=% -addr=buffers RangeBuffersAll :let lines = [<line1>, <line2>]
|
||||||
|
|
||||||
.,$RangeLoadedBuffers
|
.,$RangeLoadedBuffers
|
||||||
call assert_equal([1, 1], lines)
|
call assert_equal([bufnr, bufnr], lines)
|
||||||
%RangeLoadedBuffers
|
%RangeLoadedBuffers
|
||||||
call assert_equal([1, 1], lines)
|
call assert_equal([bufnr, bufnr], lines)
|
||||||
RangeLoadedBuffersAll
|
RangeLoadedBuffersAll
|
||||||
call assert_equal([1, 1], lines)
|
call assert_equal([bufnr, bufnr], lines)
|
||||||
.,$RangeBuffers
|
.,$RangeBuffers
|
||||||
call assert_equal([1, lastbuf], lines)
|
call assert_equal([bufnr, lastbuf], lines)
|
||||||
%RangeBuffers
|
%RangeBuffers
|
||||||
call assert_equal([1, lastbuf], lines)
|
call assert_equal([bufnr, lastbuf], lines)
|
||||||
RangeBuffersAll
|
RangeBuffersAll
|
||||||
call assert_equal([1, lastbuf], lines)
|
call assert_equal([bufnr, lastbuf], lines)
|
||||||
|
|
||||||
delcommand RangeLoadedBuffers
|
delcommand RangeLoadedBuffers
|
||||||
delcommand RangeLoadedBuffersAll
|
delcommand RangeLoadedBuffersAll
|
||||||
@ -138,6 +139,7 @@ func Test_command_count_2()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_command_count_3()
|
func Test_command_count_3()
|
||||||
|
let bufnr = bufnr('%')
|
||||||
se nohidden
|
se nohidden
|
||||||
e aaa
|
e aaa
|
||||||
let buf_aaa = bufnr('%')
|
let buf_aaa = bufnr('%')
|
||||||
@ -145,7 +147,7 @@ func Test_command_count_3()
|
|||||||
let buf_bbb = bufnr('%')
|
let buf_bbb = bufnr('%')
|
||||||
e ccc
|
e ccc
|
||||||
let buf_ccc = bufnr('%')
|
let buf_ccc = bufnr('%')
|
||||||
buf 1
|
exe bufnr . 'buf'
|
||||||
call assert_equal([1, 1, 1], [buflisted(buf_aaa), buflisted(buf_bbb), buflisted(buf_ccc)])
|
call assert_equal([1, 1, 1], [buflisted(buf_aaa), buflisted(buf_bbb), buflisted(buf_ccc)])
|
||||||
exe buf_bbb . "," . buf_ccc . "bdelete"
|
exe buf_bbb . "," . buf_ccc . "bdelete"
|
||||||
call assert_equal([1, 0, 0], [buflisted(buf_aaa), buflisted(buf_bbb), buflisted(buf_ccc)])
|
call assert_equal([1, 0, 0], [buflisted(buf_aaa), buflisted(buf_bbb), buflisted(buf_ccc)])
|
||||||
@ -155,7 +157,7 @@ endfunc
|
|||||||
|
|
||||||
func Test_command_count_4()
|
func Test_command_count_4()
|
||||||
%argd
|
%argd
|
||||||
let bufnr = bufnr('$') + 1
|
let bufnr = bufnr('$')
|
||||||
arga aa bb cc dd ee ff
|
arga aa bb cc dd ee ff
|
||||||
3argu
|
3argu
|
||||||
let args = []
|
let args = []
|
||||||
@ -171,6 +173,8 @@ func Test_command_count_4()
|
|||||||
only!
|
only!
|
||||||
|
|
||||||
exe bufnr . 'buf'
|
exe bufnr . 'buf'
|
||||||
|
bnext
|
||||||
|
let bufnr = bufnr('%')
|
||||||
let buffers = []
|
let buffers = []
|
||||||
.,$-bufdo call add(buffers, bufnr('%'))
|
.,$-bufdo call add(buffers, bufnr('%'))
|
||||||
call assert_equal([bufnr, bufnr + 1, bufnr + 2, bufnr + 3, bufnr + 4], buffers)
|
call assert_equal([bufnr, bufnr + 1, bufnr + 2, bufnr + 3, bufnr + 4], buffers)
|
||||||
|
@ -50,6 +50,7 @@ endfunc
|
|||||||
" We don't check much of the contents.
|
" We don't check much of the contents.
|
||||||
func Test_with_syntax()
|
func Test_with_syntax()
|
||||||
if has('postscript')
|
if has('postscript')
|
||||||
|
edit test_hardcopy.vim
|
||||||
set printoptions=syntax:y
|
set printoptions=syntax:y
|
||||||
syn on
|
syn on
|
||||||
hardcopy > Xhardcopy
|
hardcopy > Xhardcopy
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
" Test for insert expansion
|
" Test for insert expansion
|
||||||
func Test_ins_complete()
|
func Test_ins_complete()
|
||||||
|
edit test_ins_complete.vim
|
||||||
set ff=unix
|
set ff=unix
|
||||||
call writefile(["test11\t36Gepeto\t/Tag/",
|
call writefile(["test11\t36Gepeto\t/Tag/",
|
||||||
\ "asd\ttest11file\t36G",
|
\ "asd\ttest11file\t36G",
|
||||||
|
@ -151,7 +151,7 @@ endfunc
|
|||||||
func XageTests(cchar)
|
func XageTests(cchar)
|
||||||
call s:setup_commands(a:cchar)
|
call s:setup_commands(a:cchar)
|
||||||
|
|
||||||
let list = [{'bufnr': 1, 'lnum': 1}]
|
let list = [{'bufnr': bufnr('%'), 'lnum': 1}]
|
||||||
call g:Xsetlist(list)
|
call g:Xsetlist(list)
|
||||||
|
|
||||||
" Jumping to a non existent list should return error
|
" Jumping to a non existent list should return error
|
||||||
|
@ -182,7 +182,7 @@ func Test_sign_invalid_commands()
|
|||||||
call assert_fails('sign define Sign1 xxx', 'E475:')
|
call assert_fails('sign define Sign1 xxx', 'E475:')
|
||||||
call assert_fails('sign undefine', 'E156:')
|
call assert_fails('sign undefine', 'E156:')
|
||||||
call assert_fails('sign list xxx', 'E155:')
|
call assert_fails('sign list xxx', 'E155:')
|
||||||
call assert_fails('sign place 1 buffer=', 'E158:')
|
call assert_fails('sign place 1 buffer=999', 'E158:')
|
||||||
call assert_fails('sign define Sign2 text=', 'E239:')
|
call assert_fails('sign define Sign2 text=', 'E239:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user