fix(core): align patch Unicode matching (#38160)

This commit is contained in:
Aiden Cline 2026-07-21 13:47:52 -05:00 committed by GitHub
commit 6ec17e5d55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View file

@ -200,6 +200,22 @@ describe("Patch", () => {
)
})
test("does not normalize ellipses", () => {
expect(() =>
Patch.derive("ellipsis.txt", [{ oldLines: ["wait..."], newLines: ["done"] }], "wait…\n"),
).toThrow("Failed to find expected lines")
})
test("prefers a later exact match over an earlier normalized match", () => {
expect(
Patch.derive(
"quotes.txt",
[{ oldLines: ['He said "hello"'], newLines: ['He said "goodbye"'] }],
'He said “hello”\nmiddle\nHe said "hello"\n',
).content,
).toBe('He said “hello”\nmiddle\nHe said "goodbye"\n')
})
test("matches EOF-anchored chunks from the end", () => {
expect(
Patch.derive(