Skip to content

Commit 63b29df

Browse files
committed
Add new test
1 parent c59ae2b commit 63b29df

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/core/diff/strategies/__tests__/multi-search-replace.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,6 +1436,25 @@ function five() {
14361436
expect(result.success).toBe(true)
14371437
})
14381438

1439+
it("handles escaping of markers with custom suffixes", async () => {
1440+
const originalContent = "before\n<<<<<<< HEAD\nmiddle\n>>>>>>> feature-branch\nafter\n"
1441+
const diffContent =
1442+
"<<<<<<< SEARCH\n" +
1443+
"before\n" +
1444+
"\\<<<<<<< HEAD\n" +
1445+
"middle\n" +
1446+
"\\>>>>>>> feature-branch\n" +
1447+
"after\n" +
1448+
"=======\n" +
1449+
"replaced content\n" +
1450+
">>>>>>> REPLACE"
1451+
const result = await strategy.applyDiff(originalContent, diffContent)
1452+
expect(result.success).toBe(true)
1453+
if (result.success) {
1454+
expect(result.content).toBe("replaced content\n")
1455+
}
1456+
})
1457+
14391458
it("detects separator when expecting replace", () => {
14401459
const diff = "<<<<<<< SEARCH\n" + "content\n" + "=======\n" + "new content\n" + "======="
14411460
const result = strategy["validateMarkerSequencing"](diff)

0 commit comments

Comments
 (0)