diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2026-02-13 21:02:40 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-13 21:02:40 +0800 |
| commit | 9c5ade9212d897db590aeb6a2a5340e73ffe44d0 (patch) | |
| tree | e80e7276533523f7a204e4810f141afc83c15865 /test/functional/vimscript/wait_spec.lua | |
| parent | a7a7cdbcda1f0ef5a29742aea973d2d1c0bfa9a0 (diff) | |
| download | rneovim-9c5ade9212d897db590aeb6a2a5340e73ffe44d0.tar.gz rneovim-9c5ade9212d897db590aeb6a2a5340e73ffe44d0.tar.bz2 rneovim-9c5ade9212d897db590aeb6a2a5340e73ffe44d0.zip | |
fix: wait() checks condition twice on each interval (#37837)
Problem: wait() checks condition twice on each interval.
Solution: Don't schedule the due callback. Also fix memory leak when
Nvim exits while waiting.
No test that the condition isn't checked twice, as testing for that can
be flaky when there are libuv events from other sources.
Diffstat (limited to 'test/functional/vimscript/wait_spec.lua')
| -rw-r--r-- | test/functional/vimscript/wait_spec.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/vimscript/wait_spec.lua b/test/functional/vimscript/wait_spec.lua index 0932bd3593..3ac7399c52 100644 --- a/test/functional/vimscript/wait_spec.lua +++ b/test/functional/vimscript/wait_spec.lua @@ -78,4 +78,15 @@ describe('wait()', function() eq('Vim:E475: Invalid value for argument 3', pcall_err(call, 'wait', 0, 1, 0)) eq('Vim:E475: Invalid value for argument 3', pcall_err(call, 'wait', 0, 1, '')) end) + + it('does not leak when Nvim exits while waiting', function() + n.expect_exit( + 500, + source, + [[ + call timer_start(10, {-> execute('qall!')}) + call wait(10000, 0) + ]] + ) + end) end) |