summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:20:59 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:20:59 +0200
commit51d029e037f233e3239d426d151630ec4897d4fb (patch)
tree91617e922914ee79e548d529ad8ac5ac327e75fd /tests/run.lua
parentbd0a050c72ece85e071abe176962b256232082b8 (diff)
Transform forward TILL destinations
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 183c9af..e11bf1f 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -2347,6 +2347,42 @@ test("FIND destinations use matching target positions", function()
)
end)
+test("Forward TILL destinations use target predecessors", function()
+ local view = text_topology.new({
+ "poge huga hiyo poyo",
+ "x",
+ }, "utf-8")
+ local engine = destination_engine.new()
+ local till_h = motion_plan.build(
+ target_plan.build(target("h"), matching_policy()),
+ "t"
+ )
+ same(
+ domain.Position.new(1, 5),
+ engine:calculate(
+ view,
+ domain.Position.new(1, 1),
+ till_h,
+ 1,
+ true
+ ).endpoint
+ )
+
+ local till_x = motion_plan.build(
+ target_plan.build(target("x"), matching_policy()),
+ "t"
+ )
+ local cross_line = engine:calculate(
+ view,
+ domain.Position.new(1, 18),
+ till_x,
+ 1,
+ true
+ )
+ same(domain.Position.new(1, 19), cross_line.endpoint)
+ truthy(view:is_valid_cursor_position(cross_line.endpoint))
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then