From 450f71774898d6aba1818a92bfb5035237573d16 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:39:43 +0200 Subject: Release finalized feedback resources --- tests/run.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index 2a0786f..6244677 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -6261,6 +6261,42 @@ test("Insert and text events finalize feedback directly", function() end end) +test("Full finalization removes owned registrations and window overlays", function() + local state, transitions = fresh_sequence_state() + local host = MemoryHost.new({ buffer_lines = { "aba" } }) + local feedback = feedback_service.new({ + host = host, + transitions = transitions, + }) + local shared_target = target_plan.build(target("a"), matching_policy()) + local movement = motion_plan.build(shared_target, "f") + local current = feedback:request_persistent({ + context = "n", + anchor = domain.Position.new(1, 1), + target_plan = shared_target, + motion_plan = movement, + window = "window-1", + }) + local peer = host:create_highlight({ + group = "CleverFChar", + window = "window-2", + positions = {}, + priority = feedback_service.Priority.HIGH, + }) + transitions:AddTargetOverlay(peer, "window-2", 1) + + local cleanup = feedback:full_finalize("window-1") + + same(1, #cleanup.finalizers) + same(current.finalizers.identity, cleanup.finalizers[1].identity) + falsy(host:event_registrations()[current.finalizers.identity].active) + same(nil, host:highlights()[current.identity]) + truthy(host:highlights()[peer] ~= nil) + same(1, #state.target_overlays) + same(peer, state.target_overlays[1].identity) + same(0, #state.finalizers) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3