neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 3e79afec5485b17fe8e91658cc1de6fab6ec55f1
parent 6bf5b2428b146330688922d66438357c0568725d
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Mon, 21 Aug 2023 13:13:48 +0800

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>

Diffstat:
Mtest/old/testdir/test_autocmd.vim | 30++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+), 0 deletions(-)

diff --git 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