From 573556d69a64d2b044996e1b7eac986027b9dfda Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 11:44:04 +0200 Subject: Count uppercase smart-case folds --- tests/run.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index ba6757f..4984fb6 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -4692,6 +4692,24 @@ test("Smart-case previews increment every exact character counter", function() same(domain.Position.new(1, 5), positions[2]) end) +test("Smart-case previews add ASCII uppercase to lowercase counters", function() + local planner = direct_preview_planner.new({ lowercase = string.lower }) + local view = text_topology.new({ "xAa" }, "utf-8") + local positions = planner:plan( + view, + domain.Position.new(1, 1), + "f", + 2, + { ignore_case = false, smart_case = true } + ) + + same(1, #positions) + same(domain.Position.new(1, 3), positions[1]) + truthy(direct_preview_planner.is_upper_ascii("A")) + falsy(direct_preview_planner.is_upper_ascii("a")) + falsy(direct_preview_planner.is_upper_ascii("AA")) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3