summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:39:43 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:39:43 +0200
commit450f71774898d6aba1818a92bfb5035237573d16 (patch)
tree555cc78f3046b64de5ee0205a05cdcc2e0045019 /tests/run.lua
parent612775c292ccd58fba666728497b0a469101c578 (diff)
Release finalized feedback resources
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua36
1 files changed, 36 insertions, 0 deletions
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