From 1d7cf6fe16c4b1e9a2cfc71b9feb098118cf7ca8 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 10:27:07 +0200 Subject: Advance sequential count origins --- tests/run.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index 6d9289e..209cf28 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -2712,6 +2712,38 @@ test("Later TILL moves skip an adjacent stationary destination", function() ) end) +test("Sequential counts reuse each accepted destination as origin", function() + local view = text_topology.new({ "abxbxb" }, "utf-8") + local matched_starts = {} + local target_match = domain.TargetPlan.new({ + target = target("b"), + kind = domain.TargetPlanKind.LITERAL, + case_mode = domain.CaseMode.SENSITIVE, + matcher = function(character, position) + if character == "b" then + matched_starts[#matched_starts + 1] = tostring(position) + return true + end + return false + end, + }) + local outcome = destination_engine.calculate( + view, + domain.Position.new(1, 1), + motion_plan.build(target_match, "t"), + 3, + true + ) + + same(domain.SearchStatus.COMPLETE, outcome.status) + same(domain.Position.new(1, 5), outcome.endpoint) + same(3, outcome.successful_steps) + list_same( + { "(1,2)", "(1,2)", "(1,4)", "(1,4)", "(1,6)" }, + matched_starts + ) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3