From 5a51b5692e29ac4ab2ceda5888126745b99823d7 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 11:44:24 +0200 Subject: Mark smart-case preview union --- tests/run.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index 4984fb6..718488b 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -4710,6 +4710,31 @@ test("Smart-case previews add ASCII uppercase to lowercase counters", function() falsy(direct_preview_planner.is_upper_ascii("AA")) end) +test("Smart-case previews mark the exact and lowercase union", function() + local planner = direct_preview_planner.new({ lowercase = string.lower }) + local origin = domain.Position.new(1, 1) + + local folded_position = planner:plan( + text_topology.new({ "xaA" }, "utf-8"), + origin, + "f", + 2, + { ignore_case = false, smart_case = true } + ) + same(1, #folded_position) + same(domain.Position.new(1, 3), folded_position[1]) + + local one_marker = planner:plan( + text_topology.new({ "xAA" }, "utf-8"), + origin, + "f", + 2, + { ignore_case = false, smart_case = true } + ) + same(1, #one_marker) + same(domain.Position.new(1, 3), one_marker[1]) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3