mirror of
https://github.com/neovim/neovim.git
synced 2026-07-14 05:10:36 +00:00
test(autoread): unreliable "coalesces rapid changes via debouncing"
previous: #40272 FAILED …/autoread_spec.lua @ 142: autoread file watcher coalesces rapid changes via debouncing Expected values to be equal. Expected: 1 Actual: 2 stack traceback: …/autoread_spec.lua:169: in function <…/autoread_spec.lua:142>
This commit is contained in:
@@ -163,10 +163,13 @@ describe('autoread file watcher', function()
|
||||
eq({ 'final' }, api.nvim_buf_get_lines(0, 0, -1, true))
|
||||
end)
|
||||
|
||||
-- Let any late-arriving event flush (> debounce window), then assert all 4 writes coalesced.
|
||||
-- Every fs_event restarts the debounce timer, so the timer fires exactly once.
|
||||
-- Debouncing collapses 4 writes into (ideally) 1 reload. But we assert "<=2" bc OS filewatch
|
||||
-- events may arrive in multiple batches under CI load => a straggler may arrive after the
|
||||
-- debounce window and trigger a second reload.
|
||||
-- The buffer already holds "final" (checked above); without debouncing each write would reload.
|
||||
sleep(250)
|
||||
eq(1, n.exec_lua('return _G.reloads'))
|
||||
local reloads = n.exec_lua('return _G.reloads')
|
||||
t.ok(reloads >= 1 and reloads <= 2, '1 or 2 reloads (4 writes coalesced)', reloads)
|
||||
end)
|
||||
|
||||
it("bumps 'busy' on each watched buffer while a reload is pending", function()
|
||||
|
||||
Reference in New Issue
Block a user