summaryrefslogtreecommitdiff
path: root/src/testdir/test_timers.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-08-16 11:26:06 +0200
committerBram Moolenaar <Bram@vim.org>2019-08-16 11:26:06 +0200
commit9a2fddcf04192a643dc97601d689c27f5bc5184f (patch)
treefcbc7786d67d7ee6a8b7efaaeb5820d777d0c7d5 /src/testdir/test_timers.vim
parent973d5304a44c974e74e43c3790f8919b7d4193b4 (diff)
downloadvim-git-9a2fddcf04192a643dc97601d689c27f5bc5184f.tar.gz
patch 8.1.1855: another failing timer testv8.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.
Diffstat (limited to 'src/testdir/test_timers.vim')
-rw-r--r--src/testdir/test_timers.vim37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim
index caeb23014..e504a89f3 100644
--- a/src/testdir/test_timers.vim
+++ b/src/testdir/test_timers.vim
@@ -14,7 +14,7 @@ func MyHandlerWithLists(lists, timer)
let x = string(a:lists)
endfunc
-func Test_oneshot()
+func Test_timer_oneshot()
let g:val = 0
let timer = timer_start(50, 'MyHandler')
let slept = WaitFor('g:val == 1')
@@ -26,7 +26,7 @@ func Test_oneshot()
endif
endfunc
-func Test_repeat_three()
+func Test_timer_repeat_three()
let g:val = 0
let timer = timer_start(50, 'MyHandler', {'repeat': 3})
let slept = WaitFor('g:val == 3')
@@ -38,7 +38,7 @@ func Test_repeat_three()
endif
endfunc
-func Test_repeat_many()
+func Test_timer_repeat_many()
let g:val = 0
let timer = timer_start(50, 'MyHandler', {'repeat': -1})
sleep 200m
@@ -46,7 +46,7 @@ func Test_repeat_many()
call assert_inrange(2, 5, g:val)
endfunc
-func Test_with_partial_callback()
+func Test_timer_with_partial_callback()
let g:val = 0
let meow = {'one': 1}
function meow.bite(...)
@@ -63,13 +63,13 @@ func Test_with_partial_callback()
endif
endfunc
-func Test_retain_partial()
+func Test_timer_retain_partial()
call timer_start(50, function('MyHandlerWithLists', [['a']]))
call test_garbagecollect_now()
sleep 100m
endfunc
-func Test_info()
+func Test_timer_info()
let id = timer_start(1000, 'MyHandler')
let info = timer_info(id)
call assert_equal(id, info[0]['id'])
@@ -91,7 +91,7 @@ func Test_info()
call assert_equal([], timer_info(id))
endfunc
-func Test_stopall()
+func Test_timer_stopall()
let id1 = timer_start(1000, 'MyHandler')
let id2 = timer_start(2000, 'MyHandler')
let info = timer_info()
@@ -102,7 +102,7 @@ func Test_stopall()
call assert_equal(0, len(info))
endfunc
-func Test_paused()
+func Test_timer_paused()
let g:val = 0
let id = timer_start(50, 'MyHandler')
@@ -140,7 +140,7 @@ func StopMyself(timer)
endif
endfunc
-func Test_delete_myself()
+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,16 +159,17 @@ func StopTimer2(timer)
call timer_stop(g:timer1)
endfunc
-func Test_stop_in_callback()
+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_stop_all_in_callback()
+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,7 +188,7 @@ func InputCb(timer)
call Resume()
endfunc
-func Test_input_in_timer()
+func Test_timer_input_in_timer()
let g:val = ''
call timer_start(10, 'InputCb')
call Standby(1000)
@@ -238,7 +239,7 @@ func Interrupt(timer)
call test_feedinput("\<C-C>")
endfunc
-func Test_peek_and_get_char()
+func Test_timer_peek_and_get_char()
CheckUnix
CheckGui
@@ -249,7 +250,7 @@ func Test_peek_and_get_char()
call timer_stop(intr)
endfunc
-func Test_getchar_zero()
+func Test_timer_getchar_zero()
if has('win32') && !has('gui_running')
throw 'Skipped: cannot get low-level input'
endif
@@ -266,7 +267,7 @@ func Test_getchar_zero()
call timer_stop(id)
endfunc
-func Test_ex_mode()
+func Test_timer_ex_mode()
" Function with an empty line.
func Foo(...)
@@ -277,7 +278,7 @@ func Test_ex_mode()
call timer_stop(timer)
endfunc
-func Test_restore_count()
+func Test_timer_restore_count()
if !CanRunVimInTerminal()
throw 'Skipped: cannot run Vim in a terminal window'
endif
@@ -310,7 +311,7 @@ endfunc
" Test that the garbage collector isn't triggered if a timer callback invokes
" vgetc().
-func Test_nocatch_garbage_collect()
+func Test_timer_nocatch_garbage_collect()
" 'uptimetime. must be bigger than the timer timeout
set ut=200
call test_garbagecollect_soon()
@@ -332,7 +333,7 @@ func Test_nocatch_garbage_collect()
delfunc FeedChar
endfunc
-func Test_error_in_timer_callback()
+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