Patch 8.1.1855

8 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 16, 2019, 5:26:55 AM8/16/19
to vim...@googlegroups.com

Patch 8.1.1855
Problem: Another failing timer test.
Solution: Assert that timers are finished by the end of the test. Rename
test functions to make them easier to find.
Files: src/testdir/test_timers.vim, src/testdir/runtest.vim


*** ../vim-8.1.1854/src/testdir/test_timers.vim 2019-08-15 23:42:15.311873676 +0200
--- src/testdir/test_timers.vim 2019-08-16 11:24:06.554001635 +0200
***************
*** 14,20 ****
let x = string(a:lists)
endfunc

! func Test_oneshot()
let g:val = 0
let timer = timer_start(50, 'MyHandler')
let slept = WaitFor('g:val == 1')
--- 14,20 ----
let x = string(a:lists)
endfunc

! func Test_timer_oneshot()
let g:val = 0
let timer = timer_start(50, 'MyHandler')
let slept = WaitFor('g:val == 1')
***************
*** 26,32 ****
endif
endfunc

! func Test_repeat_three()
let g:val = 0
let timer = timer_start(50, 'MyHandler', {'repeat': 3})
let slept = WaitFor('g:val == 3')
--- 26,32 ----
endif
endfunc

! func Test_timer_repeat_three()
let g:val = 0
let timer = timer_start(50, 'MyHandler', {'repeat': 3})
let slept = WaitFor('g:val == 3')
***************
*** 38,44 ****
endif
endfunc

! func Test_repeat_many()
let g:val = 0
let timer = timer_start(50, 'MyHandler', {'repeat': -1})
sleep 200m
--- 38,44 ----
endif
endfunc

! func Test_timer_repeat_many()
let g:val = 0
let timer = timer_start(50, 'MyHandler', {'repeat': -1})
sleep 200m
***************
*** 46,52 ****
call assert_inrange(2, 5, g:val)
endfunc

! func Test_with_partial_callback()
let g:val = 0
let meow = {'one': 1}
function meow.bite(...)
--- 46,52 ----
call assert_inrange(2, 5, g:val)
endfunc

! func Test_timer_with_partial_callback()
let g:val = 0
let meow = {'one': 1}
function meow.bite(...)
***************
*** 63,75 ****
endif
endfunc

! func Test_retain_partial()
call timer_start(50, function('MyHandlerWithLists', [['a']]))
call test_garbagecollect_now()
sleep 100m
endfunc

! func Test_info()
let id = timer_start(1000, 'MyHandler')
let info = timer_info(id)
call assert_equal(id, info[0]['id'])
--- 63,75 ----
endif
endfunc

! func Test_timer_retain_partial()
call timer_start(50, function('MyHandlerWithLists', [['a']]))
call test_garbagecollect_now()
sleep 100m
endfunc

! func Test_timer_info()
let id = timer_start(1000, 'MyHandler')
let info = timer_info(id)
call assert_equal(id, info[0]['id'])
***************
*** 91,97 ****
call assert_equal([], timer_info(id))
endfunc

! func Test_stopall()
let id1 = timer_start(1000, 'MyHandler')
let id2 = timer_start(2000, 'MyHandler')
let info = timer_info()
--- 91,97 ----
call assert_equal([], timer_info(id))
endfunc

! func Test_timer_stopall()
let id1 = timer_start(1000, 'MyHandler')
let id2 = timer_start(2000, 'MyHandler')
let info = timer_info()
***************
*** 102,108 ****
call assert_equal(0, len(info))
endfunc

! func Test_paused()
let g:val = 0

let id = timer_start(50, 'MyHandler')
--- 102,108 ----
call assert_equal(0, len(info))
endfunc

! func Test_timer_paused()
let g:val = 0

let id = timer_start(50, 'MyHandler')
***************
*** 140,146 ****
endif
endfunc

! func Test_delete_myself()
let g:called = 0
let t = timer_start(10, 'StopMyself', {'repeat': -1})
call WaitForAssert({-> assert_equal(2, g:called)})
--- 140,146 ----
endif
endfunc

! func Test_timer_delete_myself()
let g:called = 0
let t = timer_start(10, 'StopMyself', {'repeat': -1})
call WaitForAssert({-> assert_equal(2, g:called)})
***************
*** 159,174 ****
call timer_stop(g:timer1)
endfunc

! func Test_stop_in_callback()
let g:timer1 = timer_start(10, 'StopTimer1')
sleep 40m
endfunc

func StopTimerAll(timer)
call timer_stopall()
endfunc

! func Test_stop_all_in_callback()
let g:timer1 = timer_start(10, 'StopTimerAll')
let info = timer_info()
call assert_equal(1, len(info))
--- 159,175 ----
call timer_stop(g:timer1)
endfunc

! func Test_timer_stop_in_callback()
let g:timer1 = timer_start(10, 'StopTimer1')
sleep 40m
+ call assert_equal(0, len(timer_info()))
endfunc

func StopTimerAll(timer)
call timer_stopall()
endfunc

! func Test_timer_stop_all_in_callback()
let g:timer1 = timer_start(10, 'StopTimerAll')
let info = timer_info()
call assert_equal(1, len(info))
***************
*** 187,193 ****
call Resume()
endfunc

! func Test_input_in_timer()
let g:val = ''
call timer_start(10, 'InputCb')
call Standby(1000)
--- 188,194 ----
call Resume()
endfunc

! func Test_timer_input_in_timer()
let g:val = ''
call timer_start(10, 'InputCb')
call Standby(1000)
***************
*** 238,244 ****
call test_feedinput("\<C-C>")
endfunc

! func Test_peek_and_get_char()
CheckUnix
CheckGui

--- 239,245 ----
call test_feedinput("\<C-C>")
endfunc

! func Test_timer_peek_and_get_char()
CheckUnix
CheckGui

***************
*** 249,255 ****
call timer_stop(intr)
endfunc

! func Test_getchar_zero()
if has('win32') && !has('gui_running')
throw 'Skipped: cannot get low-level input'
endif
--- 250,256 ----
call timer_stop(intr)
endfunc

! func Test_timer_getchar_zero()
if has('win32') && !has('gui_running')
throw 'Skipped: cannot get low-level input'
endif
***************
*** 266,272 ****
call timer_stop(id)
endfunc

! func Test_ex_mode()
" Function with an empty line.
func Foo(...)

--- 267,273 ----
call timer_stop(id)
endfunc

! func Test_timer_ex_mode()
" Function with an empty line.
func Foo(...)

***************
*** 277,283 ****
call timer_stop(timer)
endfunc

! func Test_restore_count()
if !CanRunVimInTerminal()
throw 'Skipped: cannot run Vim in a terminal window'
endif
--- 278,284 ----
call timer_stop(timer)
endfunc

! func Test_timer_restore_count()
if !CanRunVimInTerminal()
throw 'Skipped: cannot run Vim in a terminal window'
endif
***************
*** 310,316 ****

" Test that the garbage collector isn't triggered if a timer callback invokes
" vgetc().
! func Test_nocatch_garbage_collect()
" 'uptimetime. must be bigger than the timer timeout
set ut=200
call test_garbagecollect_soon()
--- 311,317 ----

" Test that the garbage collector isn't triggered if a timer callback invokes
" vgetc().
! func Test_timer_nocatch_garbage_collect()
" 'uptimetime. must be bigger than the timer timeout
set ut=200
call test_garbagecollect_soon()
***************
*** 332,338 ****
delfunc FeedChar
endfunc

! func Test_error_in_timer_callback()
if !has('terminal') || (has('win32') && has('gui_running'))
throw 'Skipped: cannot run Vim in a terminal window'
endif
--- 333,339 ----
delfunc FeedChar
endfunc

! func Test_timer_error_in_timer_callback()
if !has('terminal') || (has('win32') && has('gui_running'))
throw 'Skipped: cannot run Vim in a terminal window'
endif
*** ../vim-8.1.1854/src/testdir/runtest.vim 2019-08-16 10:51:07.054583655 +0200
--- src/testdir/runtest.vim 2019-08-16 11:24:24.101936041 +0200
***************
*** 323,342 ****
\ 'Test_exit_callback()',
\ 'Test_exit_callback_interval()',
\ 'Test_nb_basic()',
- \ 'Test_oneshot()',
\ 'Test_open_delay()',
\ 'Test_out_cb()',
- \ 'Test_paused()',
\ 'Test_pipe_through_sort_all()',
\ 'Test_pipe_through_sort_some()',
\ 'Test_quoteplus()',
\ 'Test_quotestar()',
\ 'Test_raw_one_time_callback()',
\ 'Test_reltime()',
- \ 'Test_repeat_many()',
- \ 'Test_repeat_three()',
\ 'Test_server_crash()',
- \ 'Test_stop_all_in_callback()',
\ 'Test_terminal_ansicolors_default()',
\ 'Test_terminal_ansicolors_func()',
\ 'Test_terminal_ansicolors_global()',
--- 323,337 ----
***************
*** 359,367 ****
\ 'Test_terminal_wall()',
\ 'Test_terminal_wipe_buffer()',
\ 'Test_terminal_wqall()',
\ 'Test_two_channels()',
\ 'Test_unlet_handle()',
! \ 'Test_with_partial_callback()',
\ 'Test_zero_reply()',
\ 'Test_zz1_terminal_in_gui()',
\ ]
--- 354,368 ----
\ 'Test_terminal_wall()',
\ 'Test_terminal_wipe_buffer()',
\ 'Test_terminal_wqall()',
+ \ 'Test_timer_oneshot()',
+ \ 'Test_timer_paused()',
+ \ 'Test_timer_repeat_many()',
+ \ 'Test_timer_repeat_three()',
+ \ 'Test_timer_stop_all_in_callback()',
+ \ 'Test_timer_stop_in_callback()',
\ 'Test_two_channels()',
\ 'Test_unlet_handle()',
! \ 'Test_timer_with_partial_callback()',
\ 'Test_zero_reply()',
\ 'Test_zz1_terminal_in_gui()',
\ ]
*** ../vim-8.1.1854/src/version.c 2019-08-16 10:51:07.058583639 +0200
--- src/version.c 2019-08-16 11:24:55.897816072 +0200
***************
*** 771,772 ****
--- 771,774 ----
{ /* Add new patch number below this line */
+ /**/
+ 1855,
/**/

--
hundred-and-one symptoms of being an internet addict:
60. As your car crashes through the guardrail on a mountain road, your first
instinct is to search for the "back" button.

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages