diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index eac53bf..7431de5 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -2839,6 +2839,50 @@ test("Partial outcomes retain the last intermediate destination", function() same(2, till_partial.successful_steps) end) +test("Boundary-before-any outcomes preserve the original position", function() + local engine = destination_engine.new() + local view = text_topology.new({ "", "abc" }, "utf-8") + local origin = domain.Position.new(1, 1) + local missing = motion_plan.build( + target_plan.build(target("z"), matching_policy()), + "f", + "buffer" + ) + local missing_outcome = engine:calculate(view, origin, missing, 4, true) + same(domain.SearchStatus.BOUNDARY_BEFORE_ANY, missing_outcome.status) + same(origin, missing_outcome.endpoint) + same(0, missing_outcome.successful_steps) + + local adjacent_view = text_topology.new({ "ab" }, "utf-8") + local adjacent_origin = domain.Position.new(1, 1) + local repeated_till = motion_plan.build( + target_plan.build(target("b"), matching_policy()), + "t" + ) + local adjacent_outcome = engine:calculate( + adjacent_view, + adjacent_origin, + repeated_till, + 1, + false + ) + same(domain.SearchStatus.BOUNDARY_BEFORE_ANY, adjacent_outcome.status) + same(adjacent_origin, adjacent_outcome.endpoint) + same(0, adjacent_outcome.successful_steps) + + local all_empty = text_topology.new({ "", "" }, "utf-8") + local empty_origin = domain.Position.new(2, 1) + local empty_outcome = engine:calculate( + all_empty, + empty_origin, + missing, + 1, + true + ) + same(domain.SearchStatus.BOUNDARY_BEFORE_ANY, empty_outcome.status) + same(empty_origin, empty_outcome.endpoint) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
