summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua18
1 files changed, 18 insertions, 0 deletions
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