summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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