From f04282c17fa96e88e939e17d823489dbf10594e7 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 10:25:07 +0200 Subject: Enforce strict FIND destinations --- tests/run.lua | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index 60d6b5b..1f9b9da 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -2569,6 +2569,55 @@ test("MotionPlanFactory limits exclusive policy to character and line Visual", f ) end) +test("FIND requires destinations on the strict motion side", function() + local view = text_topology.new({ "axa" }, "utf-8") + local engine = destination_engine.new() + local target_match = target_plan.build(target("a"), matching_policy()) + local forward = motion_plan.build(target_match, "f") + local backward = motion_plan.build(target_match, "F") + + same( + domain.Position.new(1, 3), + engine:calculate( + view, + domain.Position.new(1, 1), + forward, + 1, + true + ).endpoint + ) + same( + domain.Position.new(1, 1), + engine:calculate( + view, + domain.Position.new(1, 3), + backward, + 1, + true + ).endpoint + ) + same( + domain.SearchStatus.BOUNDARY_BEFORE_ANY, + engine:calculate( + view, + domain.Position.new(1, 3), + forward, + 1, + false + ).status + ) + same( + domain.SearchStatus.BOUNDARY_BEFORE_ANY, + engine:calculate( + view, + domain.Position.new(1, 1), + backward, + 1, + false + ).status + ) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3