diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-21 13:13:48 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-08-21 14:16:16 +0800 |
commit | 3e79afec5485b17fe8e91658cc1de6fab6ec55f1 (patch) | |
tree | 0f6ad6f2d3803ac2d01691fa7e8c86f786a35135 | |
parent | 6bf5b2428b146330688922d66438357c0568725d (diff) | |
download | rneovim-3e79afec5485b17fe8e91658cc1de6fab6ec55f1.tar.gz rneovim-3e79afec5485b17fe8e91658cc1de6fab6ec55f1.tar.bz2 rneovim-3e79afec5485b17fe8e91658cc1de6fab6ec55f1.zip |
vim-patch:8.1.2067: no tests for SafeState and SafeStateAgain
Problem: No tests for SafeState and SafeStateAgain.
Solution: Add tests.
https://github.com/vim/vim/commit/cadbe1b1fbdf7d7740ae617710e0f6862fdee598
This test is quite useless. Don't port to Lua.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-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 |