summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua32
1 files changed, 32 insertions, 0 deletions
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