summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:09:07 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:09:07 +0200
commitb47d670d7613800633c91f9b22615fbd9f65c0de (patch)
tree0aa656351c980e97cdf84f4bbccb33a9e7770ae7 /tests/run.lua
parent5dbdb4010f2703d69fcd25a7045018aa3748c36b (diff)
Build fresh acquisition motion plan
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua38
1 files changed, 38 insertions, 0 deletions
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