summaryrefslogtreecommitdiff
path: root/src/testdir/test_timers.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-05 21:06:10 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-05 21:06:10 +0200
commit3fffa97159a427067b60c80ed4645e168cc5c4bd (patch)
treef0fb9f2fd843478461584c9f6444c8c15d0ae1c5 /src/testdir/test_timers.vim
parent07188fc5ef2366a3b1952e8686a4031b44152d59 (diff)
downloadvim-git-3fffa97159a427067b60c80ed4645e168cc5c4bd.tar.gz
patch 8.2.0908: crash when changing the function table while listing itv8.2.0908
Problem: Crash when changing the function table while listing it. Solution: Bail out when the function table changes. (closes #6209)
Diffstat (limited to 'src/testdir/test_timers.vim')
-rw-r--r--src/testdir/test_timers.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim
index 639f5c2d1..829e94b5d 100644
--- a/src/testdir/test_timers.vim
+++ b/src/testdir/test_timers.vim
@@ -3,6 +3,7 @@
source check.vim
CheckFeature timers
+source screendump.vim
source shared.vim
source term_util.vim
@@ -424,4 +425,28 @@ func Test_timer_invalid_callback()
call assert_fails('call timer_start(0, "0")', 'E921')
endfunc
+func Test_timer_changing_function_list()
+ CheckRunVimInTerminal
+
+ " Create a large number of functions. Should get the "more" prompt.
+ " The typing "G" triggers the timer, which changes the function table.
+ let lines =<< trim END
+ for func in map(range(1,99), "'Func' .. v:val")
+ exe "func " .. func .. "()"
+ endfunc
+ endfor
+ au CmdlineLeave : call timer_start(0, {-> 0})
+ END
+ call writefile(lines, 'XTest_timerchange')
+ let buf = RunVimInTerminal('-S XTest_timerchange', #{rows: 10})
+ call term_sendkeys(buf, ":fu\<CR>")
+ call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 10))})
+ call term_sendkeys(buf, "G")
+ call WaitForAssert({-> assert_match('E454', term_getline(buf, 9))})
+ call term_sendkeys(buf, "\<Esc>")
+
+ call StopVimInTerminal(buf)
+ call delete('XTest_timerchange')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab