diff options
Diffstat (limited to 'tests/run.lua')
| -rw-r--r-- | tests/run.lua | 36 |
1 files changed, 36 insertions, 0 deletions
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 |
