diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-09-18 22:55:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-18 22:55:30 +0800 |
commit | 647da34bbd4cf19a4bcc11899df24e00d6b8fcbe (patch) | |
tree | c67598df97c9c131eee44eebe8b9dea6c05a9604 /test/functional/autocmd/cursorhold_spec.lua | |
parent | 67df3347fd1e637f643b35239f7a20ac813ee588 (diff) | |
download | rneovim-647da34bbd4cf19a4bcc11899df24e00d6b8fcbe.tar.gz rneovim-647da34bbd4cf19a4bcc11899df24e00d6b8fcbe.tar.bz2 rneovim-647da34bbd4cf19a4bcc11899df24e00d6b8fcbe.zip |
fix: assert failure when changing 'ut' while waiting for CursorHold (#20241)
Diffstat (limited to 'test/functional/autocmd/cursorhold_spec.lua')
-rw-r--r-- | test/functional/autocmd/cursorhold_spec.lua | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/test/functional/autocmd/cursorhold_spec.lua b/test/functional/autocmd/cursorhold_spec.lua index 5d54610e1d..b04bd5233a 100644 --- a/test/functional/autocmd/cursorhold_spec.lua +++ b/test/functional/autocmd/cursorhold_spec.lua @@ -2,7 +2,6 @@ local helpers = require('test.functional.helpers')(after_each) local clear = helpers.clear local eq = helpers.eq -local eval = helpers.eval local feed = helpers.feed local retry = helpers.retry local exec = helpers.source @@ -12,13 +11,16 @@ local meths = helpers.meths before_each(clear) describe('CursorHold', function() - it('is triggered correctly #12587', function() + before_each(function() exec([[ + let g:cursorhold = 0 augroup test au CursorHold * let g:cursorhold += 1 augroup END ]]) + end) + it('is triggered correctly #12587', function() local function test_cursorhold(fn, early) local ut = 2 -- if testing with small 'updatetime' fails, double its value and test again @@ -47,6 +49,17 @@ describe('CursorHold', function() test_cursorhold(function() feed('<Ignore>') end, 0) test_cursorhold(function() meths.feedkeys(ignore_key, 'n', true) end, 0) end) + + it("reducing 'updatetime' while waiting for CursorHold #20241", function() + meths.set_option('updatetime', 10000) + feed('0') -- reset did_cursorhold + meths.set_var('cursorhold', 0) + sleep(50) + eq(0, meths.get_var('cursorhold')) + meths.set_option('updatetime', 20) + sleep(10) + eq(1, meths.get_var('cursorhold')) + end) end) describe('CursorHoldI', function() @@ -64,7 +77,7 @@ describe('CursorHoldI', function() feed('ifoo') retry(5, nil, function() sleep(1) - eq(1, eval('g:cursorhold')) + eq(1, meths.get_var('cursorhold')) end) end) end) |