diff options
-rw-r--r-- | test/old/testdir/test_autocmd.vim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index c44988321f..c279073e08 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -2959,6 +2959,36 @@ func Test_autocmd_in_try_block() au! BufEnter 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 + func Test_autocmd_CmdWinEnter() CheckRunVimInTerminal " There is not cmdwin switch, so |