diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index 4872cfd..f9fbeb8 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -2444,6 +2444,57 @@ test("Forward Visual-exclusive FIND uses target successors", function() truthy(view:is_valid_cursor_position(adjusted.endpoint)) end) +test("Forward Visual-exclusive TILL uses target positions", function() + local view = text_topology.new({ "abx", "x" }, "utf-8") + local engine = destination_engine.new() + local target_match = target_plan.build(target("x"), matching_policy()) + local regular = motion_plan.build( + target_match, + "t", + "buffer", + domain.EndpointPolicy.REGULAR + ) + local exclusive = motion_plan.build( + target_match, + "t", + "buffer", + domain.EndpointPolicy.VISUAL_EXCLUSIVE + ) + local origin = domain.Position.new(1, 1) + + same( + domain.Position.new(1, 2), + engine:calculate(view, origin, regular, 1, true).endpoint + ) + same( + domain.Position.new(1, 3), + engine:calculate(view, origin, exclusive, 1, true).endpoint + ) + + local cross_line_view = text_topology.new({ "abc", "x" }, "utf-8") + local cross_line_origin = domain.Position.new(1, 1) + same( + domain.Position.new(1, 3), + engine:calculate( + cross_line_view, + cross_line_origin, + regular, + 1, + false + ).endpoint + ) + same( + domain.Position.new(2, 1), + engine:calculate( + cross_line_view, + cross_line_origin, + exclusive, + 1, + false + ).endpoint + ) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
