diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 71 |
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 |
