summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index e11bf1f..e045a7e 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -2383,6 +2383,40 @@ test("Forward TILL destinations use target predecessors", function()
truthy(view:is_valid_cursor_position(cross_line.endpoint))
end)
+test("Backward TILL destinations use target successors", function()
+ local engine = destination_engine.new()
+ local same_line_view = text_topology.new({ "xabx" }, "utf-8")
+ local till_a = motion_plan.build(
+ target_plan.build(target("a"), matching_policy()),
+ "T"
+ )
+ same(
+ domain.Position.new(1, 3),
+ engine:calculate(
+ same_line_view,
+ domain.Position.new(1, 4),
+ till_a,
+ 1,
+ true
+ ).endpoint
+ )
+
+ local cross_line_view = text_topology.new({ "x", "abc" }, "utf-8")
+ local till_x = motion_plan.build(
+ target_plan.build(target("x"), matching_policy()),
+ "T"
+ )
+ local cross_line = engine:calculate(
+ cross_line_view,
+ domain.Position.new(2, 2),
+ till_x,
+ 1,
+ true
+ )
+ same(domain.Position.new(2, 1), cross_line.endpoint)
+ truthy(cross_line_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