Mercurial > vim
comparison src/testdir/test_timers.vim @ 20709:a2262c80a4e0 v8.2.0908
patch 8.2.0908: crash when changing the function table while listing it
Commit: https://github.com/vim/vim/commit/3fffa97159a427067b60c80ed4645e168cc5c4bd
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jun 5 21:06:10 2020 +0200
patch 8.2.0908: crash when changing the function table while listing it
Problem: Crash when changing the function table while listing it.
Solution: Bail out when the function table changes. (closes https://github.com/vim/vim/issues/6209)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 05 Jun 2020 21:15:04 +0200 |
parents | 116c7bd5e980 |
children | ff21e2962490 |
comparison
equal
deleted
inserted
replaced
20708:66b20c503d2c | 20709:a2262c80a4e0 |
---|---|
1 " Test for timers | 1 " Test for timers |
2 | 2 |
3 source check.vim | 3 source check.vim |
4 CheckFeature timers | 4 CheckFeature timers |
5 | 5 |
6 source screendump.vim | |
6 source shared.vim | 7 source shared.vim |
7 source term_util.vim | 8 source term_util.vim |
8 | 9 |
9 func MyHandler(timer) | 10 func MyHandler(timer) |
10 let g:val += 1 | 11 let g:val += 1 |
422 | 423 |
423 func Test_timer_invalid_callback() | 424 func Test_timer_invalid_callback() |
424 call assert_fails('call timer_start(0, "0")', 'E921') | 425 call assert_fails('call timer_start(0, "0")', 'E921') |
425 endfunc | 426 endfunc |
426 | 427 |
428 func Test_timer_changing_function_list() | |
429 CheckRunVimInTerminal | |
430 | |
431 " Create a large number of functions. Should get the "more" prompt. | |
432 " The typing "G" triggers the timer, which changes the function table. | |
433 let lines =<< trim END | |
434 for func in map(range(1,99), "'Func' .. v:val") | |
435 exe "func " .. func .. "()" | |
436 endfunc | |
437 endfor | |
438 au CmdlineLeave : call timer_start(0, {-> 0}) | |
439 END | |
440 call writefile(lines, 'XTest_timerchange') | |
441 let buf = RunVimInTerminal('-S XTest_timerchange', #{rows: 10}) | |
442 call term_sendkeys(buf, ":fu\<CR>") | |
443 call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 10))}) | |
444 call term_sendkeys(buf, "G") | |
445 call WaitForAssert({-> assert_match('E454', term_getline(buf, 9))}) | |
446 call term_sendkeys(buf, "\<Esc>") | |
447 | |
448 call StopVimInTerminal(buf) | |
449 call delete('XTest_timerchange') | |
450 endfunc | |
451 | |
427 " vim: shiftwidth=2 sts=2 expandtab | 452 " vim: shiftwidth=2 sts=2 expandtab |