mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Problem: No tests for SafeState and SafeStateAgain. Solution: Add tests.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
source shared.vim
|
source shared.vim
|
||||||
source check.vim
|
source check.vim
|
||||||
|
source term_util.vim
|
||||||
|
|
||||||
func s:cleanup_buffers() abort
|
func s:cleanup_buffers() abort
|
||||||
for bnr in range(1, bufnr('$'))
|
for bnr in range(1, bufnr('$'))
|
||||||
@@ -2225,3 +2226,33 @@ func Test_throw_in_BufWritePre()
|
|||||||
bwipe!
|
bwipe!
|
||||||
au! throwing
|
au! throwing
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_autocmd_SafeState()
|
||||||
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
let g:safe = 0
|
||||||
|
let g:again = ''
|
||||||
|
au SafeState * let g:safe += 1
|
||||||
|
au SafeStateAgain * let g:again ..= 'x'
|
||||||
|
func CallTimer()
|
||||||
|
call timer_start(10, {id -> execute('let g:again ..= "t"')})
|
||||||
|
endfunc
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XSafeState')
|
||||||
|
let buf = RunVimInTerminal('-S XSafeState', #{rows: 6})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":echo g:safe\<CR>")
|
||||||
|
call WaitForAssert({-> assert_match('^2 ', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":echo g:again\<CR>")
|
||||||
|
call WaitForAssert({-> assert_match('^xxxx', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":let g:again = ''\<CR>:call CallTimer()\<CR>")
|
||||||
|
call term_wait(buf)
|
||||||
|
call term_sendkeys(buf, ":echo g:again\<CR>")
|
||||||
|
call WaitForAssert({-> assert_match('xtx', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('XSafeState')
|
||||||
|
endfunc
|
||||||
|
@@ -757,6 +757,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2067,
|
||||||
/**/
|
/**/
|
||||||
2066,
|
2066,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user