From 3521acb1ddeff755e4af9c385ec0b202fa3c3333 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 10:29:06 +0200 Subject: Return partial destination outcomes --- tests/run.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index de0013f..eac53bf 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -2803,6 +2803,42 @@ test("Complete outcomes report the last destination after every count unit", fun same(2, backward_outcome.successful_steps) end) +test("Partial outcomes retain the last intermediate destination", function() + local engine = destination_engine.new() + local find_view = text_topology.new({ "axaxa" }, "utf-8") + local find_plan = motion_plan.build( + target_plan.build(target("a"), matching_policy()), + "f" + ) + local find_partial = engine:calculate( + find_view, + domain.Position.new(1, 1), + find_plan, + 3, + true + ) + same(domain.SearchStatus.BOUNDARY_AFTER_PARTIAL, find_partial.status) + falsy(find_partial.complete) + same(domain.Position.new(1, 5), find_partial.endpoint) + same(2, find_partial.successful_steps) + + local till_view = text_topology.new({ "abxb" }, "utf-8") + local till_plan = motion_plan.build( + target_plan.build(target("b"), matching_policy()), + "t" + ) + local till_partial = engine:calculate( + till_view, + domain.Position.new(1, 1), + till_plan, + 3, + true + ) + same(domain.SearchStatus.BOUNDARY_AFTER_PARTIAL, till_partial.status) + same(domain.Position.new(1, 3), till_partial.endpoint) + same(2, till_partial.successful_steps) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3