From 9a3780229bb54a73c14f2bb1ec9b0684eb5479fc Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sat, 24 Oct 2026 00:11:41 +0800 Subject: [PATCH] test(search): pin native Unicode substring matching The shared literal owner already applies Unicode simple folding. Verify the reported production-helper cases across insensitive literal, sensitive literal and regex selection. Fixes #6634 --- src/domain/analysisSearch.test.ts | 42 ++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/domain/analysisSearch.test.ts b/src/domain/analysisSearch.test.ts index 620ed65e0b..5411a693af 100644 --- a/src/domain/analysisSearch.test.ts +++ b/src/domain/analysisSearch.test.ts @@ -1,6 +1,9 @@ import { expect, it } from "vitest"; -import { literalSubstringPredicate } from "./analysisSearch.js"; +import { + analysisSearchPredicate, + literalSubstringPredicate, +} from "./analysisSearch.js"; it("uses Unicode simple case folding for literal substrings", () => { const matchesSigma = literalSubstringPredicate("Σ", false); @@ -11,3 +14,40 @@ it("uses Unicode simple case folding for literal substrings", () => { expect(literalSubstringPredicate("A.B", false)("a.b")).toBe(true); expect(literalSubstringPredicate("A.B", false)("axb")).toBe(false); }); + +it.each([ + ["Σ", "ΟΣ"], + ["σ", "ΟΣ"], + ["ς", "ΟΣ"], + ["Σ", "ΣA"], + ["foo", "FOO"], + ["ΟΣ", "ΟΣ"], +])( + "retains native literal match %s in %s when case is ignored", + (pattern, value) => { + expect( + analysisSearchPredicate({ + pattern, + mode: "literal", + case_sensitive: false, + document: undefined, + })(value), + ).toBe(true); + expect( + analysisSearchPredicate({ + pattern, + mode: "literal", + case_sensitive: true, + document: undefined, + })(value), + ).toBe(value.includes(pattern)); + expect( + analysisSearchPredicate({ + pattern, + mode: "regex", + case_sensitive: false, + document: undefined, + })(value), + ).toBe(true); + }, +);