diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2016-07-01 17:34:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-01 17:34:28 +0200 |
commit | 6f4f654231955bc655d0b8a92c21878429b8c446 (patch) | |
tree | 8e597e6425ad9d086ec6410843f1cbbcb792d458 /test/functional/eval/timer_spec.lua | |
parent | c8da12b9a6cd6060b02e06af90ea231e92724fec (diff) | |
parent | 5c754a2d2263e455ba3704cd278d52b254d195df (diff) | |
download | rneovim-6f4f654231955bc655d0b8a92c21878429b8c446.tar.gz rneovim-6f4f654231955bc655d0b8a92c21878429b8c446.tar.bz2 rneovim-6f4f654231955bc655d0b8a92c21878429b8c446.zip |
Merge pull request #4880 from bfredl/zerotimer
make timers work correctly when timeout or repeat is zero
Diffstat (limited to 'test/functional/eval/timer_spec.lua')
-rw-r--r-- | test/functional/eval/timer_spec.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua index a31e942cdf..2f83edb9e4 100644 --- a/test/functional/eval/timer_spec.lua +++ b/test/functional/eval/timer_spec.lua @@ -22,6 +22,14 @@ describe('timers', function() eq(1,eval("g:val")) end) + it('works one-shot when repeat=0', function() + execute("call timer_start(50, 'MyHandler', {'repeat': 0})") + eq(0,eval("g:val")) + run(nil, nil, nil, 200) + eq(1,eval("g:val")) + end) + + it('works with repeat two', function() execute("call timer_start(50, 'MyHandler', {'repeat': 2})") eq(0,eval("g:val")) @@ -37,6 +45,13 @@ describe('timers', function() eq(2,eval("g:val")) end) + it('works with zero timeout', function() + -- timer_start does still not invoke the callback immediately + eq(0,eval("[timer_start(0, 'MyHandler', {'repeat': 1000}), g:val][1]")) + run(nil, nil, nil, 300) + eq(1000,eval("g:val")) + end) + it('can be started during sleep', function() nvim_async("command", "sleep 10") -- this also tests that remote requests works during sleep |