From bd0a050c72ece85e071abe176962b256232082b8 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 10:20:24 +0200 Subject: Transform FIND destinations --- tests/run.lua | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index d657870..183c9af 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -2309,6 +2309,44 @@ test("DestinationEngine stops target starts at selected boundaries", function() ) end) +test("FIND destinations use matching target positions", function() + local view = text_topology.new({ "poge huga hiyo poyo" }, "utf-8") + local engine = destination_engine.new() + local h = target_plan.build(target("h"), matching_policy()) + local forward = motion_plan.build(h, "f") + local backward = motion_plan.build(h, "F") + + local first = engine:calculate( + view, + domain.Position.new(1, 1), + forward, + 1, + true + ) + same(domain.Position.new(1, 6), first.endpoint) + local second = engine:calculate(view, first.endpoint, forward, 1, false) + same(domain.Position.new(1, 11), second.endpoint) + same( + domain.Position.new(1, 6), + engine:calculate(view, second.endpoint, backward, 1, false).endpoint + ) + + local o = target_plan.build(target("o"), matching_policy()) + local find_o_backward = motion_plan.build(o, "F") + local previous = engine:calculate( + view, + domain.Position.new(1, 19), + find_o_backward, + 1, + true + ) + same(domain.Position.new(1, 17), previous.endpoint) + same( + domain.Position.new(1, 14), + engine:calculate(view, previous.endpoint, find_o_backward, 1, false).endpoint + ) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3