To: vim_dev@googlegroups.com Subject: Patch 8.2.1260 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1260 Problem: There is no good test for CursorHold. Solution: Add a test. Remove duplicated test. (Yegappan Lakshmanan, closes #6503 Files: src/testdir/test_autocmd.vim, src/testdir/test_buffer.vim, src/testdir/test_normal.vim *** ../vim-8.2.1259/src/testdir/test_autocmd.vim 2020-07-11 22:14:54.310422225 +0200 --- src/testdir/test_autocmd.vim 2020-07-21 19:43:03.166811792 +0200 *************** *** 19,24 **** --- 19,53 ---- " becomes one. endfunc + " Test for the CursorHold autocmd + func Test_CursorHold_autocmd() + CheckRunVimInTerminal + call writefile(['one', 'two', 'three'], 'Xfile') + let before =<< trim END + set updatetime=10 + au CursorHold * call writefile([line('.')], 'Xoutput', 'a') + END + call writefile(before, 'Xinit') + let buf = RunVimInTerminal('-S Xinit Xfile', {}) + call term_wait(buf) + call term_sendkeys(buf, "gg") + call term_wait(buf) + sleep 50m + call term_sendkeys(buf, "j") + call term_wait(buf) + sleep 50m + call term_sendkeys(buf, "j") + call term_wait(buf) + sleep 50m + call StopVimInTerminal(buf) + + call assert_equal(['1', '2', '3'], readfile('Xoutput')[-3:-1]) + + call delete('Xinit') + call delete('Xoutput') + call delete('Xfile') + endfunc + if has('timers') func ExitInsertMode(id) *** ../vim-8.2.1259/src/testdir/test_buffer.vim 2020-07-11 22:14:54.310422225 +0200 --- src/testdir/test_buffer.vim 2020-07-21 19:39:55.547657629 +0200 *************** *** 67,81 **** call assert_fails('1,4bunload', 'E16:') call assert_fails(',100bunload', 'E16:') - " Use a try-catch for this test. When assert_fails() is used for this - " test, the command fails with E515: instead of E90: - let caught_E90 = 0 - try - $bunload - catch /E90:/ - let caught_E90 = 1 - endtry - call assert_equal(1, caught_E90) call assert_fails('$bunload', 'E90:') endfunc --- 67,72 ---- *** ../vim-8.2.1259/src/testdir/test_normal.vim 2020-07-11 22:14:54.314422214 +0200 --- src/testdir/test_normal.vim 2020-07-21 19:43:49.510615411 +0200 *************** *** 2506,2529 **** set nomodified endfunc - func Test_normal47_autocmd() - " disabled, does not seem to be possible currently - throw "Skipped: not possible to test cursorhold autocmd while waiting for input in normal_cmd" - new - call append(0, repeat('-',20)) - au CursorHold * call feedkeys('2l', '') - 1 - set updatetime=20 - " should delete 12 chars (d12l) - call feedkeys('d1', '!') - call assert_equal('--------', getline(1)) - - " clean up - au! CursorHold - set updatetime=4000 - bw! - endfunc - func Test_normal48_wincmd() new exe "norm! \c" --- 2506,2511 ---- *** ../vim-8.2.1259/src/version.c 2020-07-21 19:25:11.414568222 +0200 --- src/version.c 2020-07-21 19:39:45.607705099 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1260, /**/ -- Master: Boy, there is nothing more for you to learn Student: I didn't know that! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///