summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 7c4c52d..7ec0baf 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -4625,6 +4625,30 @@ test("Direct preview count normalizes absent and entered values", function()
end, "positive integer")
end)
+test("Default direct previews count each exact character", function()
+ local view = text_topology.new({ "pOge huga Hiyo pOyo" }, "utf-8")
+ local planner = direct_preview_planner.new()
+ local origin = domain.Position.new(1, 1)
+
+ local function columns(positions)
+ local result = {}
+ for index, position in ipairs(positions) do
+ result[index] = position.byte_column
+ end
+ return result
+ end
+
+ list_same(
+ { 2, 3, 4, 5, 6, 7, 9, 11, 12, 13, 14, 16 },
+ columns(planner:plan(view, origin, "f", 1))
+ )
+ list_same(
+ { 8, 10, 17, 18, 19 },
+ columns(planner:plan(view, origin, "f", 2))
+ )
+ list_same({ 15 }, columns(planner:plan(view, origin, "f", 3)))
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then