From b47d670d7613800633c91f9b22615fbd9f65c0de Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:09:07 +0200 Subject: Build fresh acquisition motion plan --- tests/run.lua | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index 959de66..1249316 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -5378,6 +5378,44 @@ test("Acquisition builds one target plan from live matching policy", function() same(result.target_plan, service:last_temporary_scope().target_plan) end) +test("Acquisition builds a fresh initiating motion plan", function() + fresh_sequence_state() + local origin = domain.Position.new(1, 1) + local host = MemoryHost.new({ + buffer_lines = { "aha" }, + cursor = origin, + selection = { + active = true, + kind = "character", + anchor = origin, + focus = origin, + option = "exclusive", + }, + configuration = { + mark_cursor = false, + search_current_line_only = true, + }, + input_packets = { { kind = "text", text = "h" } }, + }) + local service = acquisition_service.new(host) + + local first = service:acquire("T", "v", origin, nil, nil) + truthy(domain.ResolvedMotionPlan.is(first.motion_plan)) + same(first.motion_plan, first.resolved_motion_plan) + same(first.motion_plan, service:last_temporary_scope().motion_plan) + same(first.target_plan, first.motion_plan.target_plan) + same(domain.Descriptor.TILL_BACKWARD, first.motion_plan.descriptor) + same(domain.SearchScope.CURRENT_LINE, first.motion_plan.search_scope) + same( + domain.EndpointPolicy.VISUAL_EXCLUSIVE, + first.motion_plan.endpoint_policy + ) + + host:push_input({ kind = "text", text = "h" }) + local second = service:acquire("T", "v", origin, nil, nil) + falsy(first.motion_plan == second.motion_plan) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3