Mercurial > vim
comparison src/testdir/test_timers.vim @ 25969:a5a772dace5b v8.2.3518
patch 8.2.3518: Test_xrestore sometimes fails
Commit: https://github.com/vim/vim/commit/f08b0eb8691ff09f98bc4beef986ece1c521655f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 16 13:00:14 2021 +0100
patch 8.2.3518: Test_xrestore sometimes fails
Problem: Test_xrestore sometimes fails.
Solution: Mark the test as flayky. Move marking test as flaky to the test
instead of listing them in runtest.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 16 Oct 2021 14:15:04 +0200 |
parents | 3efc5cb6a404 |
children | 7426c2657710 |
comparison
equal
deleted
inserted
replaced
25968:c506b33fff84 | 25969:a5a772dace5b |
---|---|
14 func MyHandlerWithLists(lists, timer) | 14 func MyHandlerWithLists(lists, timer) |
15 let x = string(a:lists) | 15 let x = string(a:lists) |
16 endfunc | 16 endfunc |
17 | 17 |
18 func Test_timer_oneshot() | 18 func Test_timer_oneshot() |
19 let g:test_is_flaky = 1 | |
19 let g:val = 0 | 20 let g:val = 0 |
20 let timer = timer_start(50, 'MyHandler') | 21 let timer = timer_start(50, 'MyHandler') |
21 let slept = WaitFor('g:val == 1') | 22 let slept = WaitFor('g:val == 1') |
22 call assert_equal(1, g:val) | 23 call assert_equal(1, g:val) |
23 if has('mac') | 24 if has('mac') |
32 call assert_inrange(20, limit, slept) | 33 call assert_inrange(20, limit, slept) |
33 endif | 34 endif |
34 endfunc | 35 endfunc |
35 | 36 |
36 func Test_timer_repeat_three() | 37 func Test_timer_repeat_three() |
38 let g:test_is_flaky = 1 | |
37 let g:val = 0 | 39 let g:val = 0 |
38 let timer = timer_start(50, 'MyHandler', {'repeat': 3}) | 40 let timer = timer_start(50, 'MyHandler', {'repeat': 3}) |
39 let slept = WaitFor('g:val == 3') | 41 let slept = WaitFor('g:val == 3') |
40 call assert_equal(3, g:val) | 42 call assert_equal(3, g:val) |
41 if has('reltime') | 43 if has('reltime') |
49 call assert_inrange(80, 200, slept) | 51 call assert_inrange(80, 200, slept) |
50 endif | 52 endif |
51 endfunc | 53 endfunc |
52 | 54 |
53 func Test_timer_repeat_many() | 55 func Test_timer_repeat_many() |
56 let g:test_is_flaky = 1 | |
54 let g:val = 0 | 57 let g:val = 0 |
55 let timer = timer_start(50, 'MyHandler', {'repeat': -1}) | 58 let timer = timer_start(50, 'MyHandler', {'repeat': -1}) |
56 sleep 200m | 59 sleep 200m |
57 call timer_stop(timer) | 60 call timer_stop(timer) |
58 " Mac on Travis can be slow. | 61 " Mac on Travis can be slow. |
62 call assert_inrange(2, 5, g:val) | 65 call assert_inrange(2, 5, g:val) |
63 endif | 66 endif |
64 endfunc | 67 endfunc |
65 | 68 |
66 func Test_timer_with_partial_callback() | 69 func Test_timer_with_partial_callback() |
70 let g:test_is_flaky = 1 | |
67 let g:val = 0 | 71 let g:val = 0 |
68 let meow = {'one': 1} | 72 let meow = {'one': 1} |
69 function meow.bite(...) | 73 function meow.bite(...) |
70 let g:val += self.one | 74 let g:val += self.one |
71 endfunction | 75 endfunction |
125 let info = timer_info() | 129 let info = timer_info() |
126 call assert_equal(0, len(info)) | 130 call assert_equal(0, len(info)) |
127 endfunc | 131 endfunc |
128 | 132 |
129 func Test_timer_paused() | 133 func Test_timer_paused() |
134 let g:test_is_flaky = 1 | |
130 let g:val = 0 | 135 let g:val = 0 |
131 | 136 |
132 let id = timer_start(50, 'MyHandler') | 137 let id = timer_start(50, 'MyHandler') |
133 let info = timer_info(id) | 138 let info = timer_info(id) |
134 call assert_equal(0, info[0]['paused']) | 139 call assert_equal(0, info[0]['paused']) |
184 func StopTimer2(timer) | 189 func StopTimer2(timer) |
185 call timer_stop(g:timer1) | 190 call timer_stop(g:timer1) |
186 endfunc | 191 endfunc |
187 | 192 |
188 func Test_timer_stop_in_callback() | 193 func Test_timer_stop_in_callback() |
194 let g:test_is_flaky = 1 | |
189 call assert_equal(0, len(timer_info())) | 195 call assert_equal(0, len(timer_info())) |
190 let g:timer1 = timer_start(10, 'StopTimer1') | 196 let g:timer1 = timer_start(10, 'StopTimer1') |
191 let slept = 0 | 197 let slept = 0 |
192 for i in range(10) | 198 for i in range(10) |
193 if len(timer_info()) == 0 | 199 if len(timer_info()) == 0 |
203 func StopTimerAll(timer) | 209 func StopTimerAll(timer) |
204 call timer_stopall() | 210 call timer_stopall() |
205 endfunc | 211 endfunc |
206 | 212 |
207 func Test_timer_stop_all_in_callback() | 213 func Test_timer_stop_all_in_callback() |
214 let g:test_is_flaky = 1 | |
208 call assert_equal(0, len(timer_info())) | 215 call assert_equal(0, len(timer_info())) |
209 call timer_start(10, 'StopTimerAll') | 216 call timer_start(10, 'StopTimerAll') |
210 call assert_equal(1, len(timer_info())) | 217 call assert_equal(1, len(timer_info())) |
211 let slept = 0 | 218 let slept = 0 |
212 for i in range(10) | 219 for i in range(10) |
469 | 476 |
470 call StopVimInTerminal(buf) | 477 call StopVimInTerminal(buf) |
471 call delete('XTest_timermessage') | 478 call delete('XTest_timermessage') |
472 endfunc | 479 endfunc |
473 | 480 |
481 | |
474 " vim: shiftwidth=2 sts=2 expandtab | 482 " vim: shiftwidth=2 sts=2 expandtab |