summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:19:39 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:19:39 +0200
commit35b29e0a23efe5fe9660ac53154cbe85b409a754 (patch)
tree7b2f304644668163e8b588aa7eadacd8ea71e2ea /tests
parent272c9cef5d40c9100968e1250036d74fa9868f71 (diff)
Bound target start enumeration
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index e84c12a..d657870 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -2238,6 +2238,77 @@ test("DestinationEngine enumerates target starts in motion order", function()
list_same({ "b:(1,2)", "a:(1,1)" }, visits)
end)
+test("DestinationEngine stops target starts at selected boundaries", function()
+ local view = text_topology.new({ "axa", "", "axa" }, "utf-8")
+ local target_match = target_plan.build(target("a"), matching_policy())
+ local engine = destination_engine.new()
+ local line_forward = motion_plan.build(target_match, "f", "current_line")
+ local buffer_forward = motion_plan.build(target_match, "f", "buffer")
+ local line_backward = motion_plan.build(target_match, "F", "current_line")
+ local buffer_backward = motion_plan.build(target_match, "F", "buffer")
+
+ same(
+ domain.Position.new(1, 3),
+ engine:calculate(
+ view,
+ domain.Position.new(1, 1),
+ line_forward,
+ 1,
+ true
+ ).endpoint
+ )
+ same(
+ domain.SearchStatus.BOUNDARY_BEFORE_ANY,
+ engine:calculate(
+ view,
+ domain.Position.new(1, 3),
+ line_forward,
+ 1,
+ false
+ ).status
+ )
+ same(
+ domain.Position.new(3, 1),
+ engine:calculate(
+ view,
+ domain.Position.new(1, 3),
+ buffer_forward,
+ 1,
+ false
+ ).endpoint
+ )
+ same(
+ domain.Position.new(3, 1),
+ engine:calculate(
+ view,
+ domain.Position.new(3, 3),
+ line_backward,
+ 1,
+ true
+ ).endpoint
+ )
+ same(
+ domain.Position.new(1, 3),
+ engine:calculate(
+ view,
+ domain.Position.new(3, 1),
+ buffer_backward,
+ 1,
+ false
+ ).endpoint
+ )
+ same(
+ domain.Position.new(3, 1),
+ engine:calculate(
+ view,
+ domain.Position.new(2, 1),
+ buffer_forward,
+ 1,
+ true
+ ).endpoint
+ )
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then