From adfb712e10e834e19c1541d0657fe4af4489be61 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:37:29 +0200 Subject: Compare cursor with input landing --- tests/run.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index 062f9ec..902d846 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -6132,6 +6132,33 @@ test("Persistent feedback owns one finalizer set", function() truthy(registrations[third.finalizers.identity].active) end) +test("CursorMoved compares the actual cursor with the last-input landing", function() + local state, transitions = fresh_sequence_state() + local landing = domain.Position.new(2, 4) + transitions:BeginAcquisition("v", "f") + transitions:CommitAcquiredTarget("v", target("a")) + transitions:CommitVisualSuccess("v", landing) + transitions:CommitCommandSuccess("n", domain.Position.new(1, 2), true) + local host = MemoryHost.new({ cursor = landing }) + local feedback = feedback_service.new({ + host = host, + state = state, + transitions = transitions, + }) + + local equal = feedback:handle_finalizer_event("CursorMoved") + same(domain.ModeContext.from_full_mode("v"), equal.context) + same(landing, equal.expected) + same(landing, equal.actual) + truthy(equal.equal) + + host:set_cursor(domain.Position.new(2, 5)) + local different = feedback:handle_finalizer_event("CursorMoved") + same(landing, different.expected) + same(domain.Position.new(2, 5), different.actual) + falsy(different.equal) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3