summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:25:07 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:25:07 +0200
commitf04282c17fa96e88e939e17d823489dbf10594e7 (patch)
treecd74d9f6a6fbc9e96471119d6b7ce0a2efb1b099 /tests/run.lua
parentde9b718b8642fa554ac1533a0e0d064bad2979d3 (diff)
Enforce strict FIND destinations
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua49
1 files changed, 49 insertions, 0 deletions
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