Skip to content

Commit 7d30818

Browse files
author
Bertan Ari
committed
test: pin 64/65-char boundary of marker hint length guard
1 parent 09b67e5 commit 7d30818

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎src/core/diff/strategies/__tests__/multi-search-replace-marker-hint.spec.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,16 @@ describe("MultiSearchReplaceDiffStrategy malformed start-line marker hint", () =
6767
expect(performance.now() - startedAt).toBeLessThan(2_000)
6868
})
6969

70-
it("still hints for a padded marker within the length guard", async () => {
71-
const diffContent = buildDiff(`start_line:${" ".repeat(40)}3\nnot-in-the-file`, "replacement")
70+
it.each([
71+
{ length: 64, hinted: true },
72+
{ length: 65, hinted: false },
73+
])("hints only while the first line fits the length guard ($length chars)", async ({ length, hinted }) => {
74+
const firstLine = `startline${" ".repeat(length - 10)}3`
75+
expect(firstLine).toHaveLength(length)
76+
const diffContent = buildDiff(`${firstLine}\nnot-in-the-file`, "replacement")
77+
const errorText = firstFailureError(await strategy.applyDiff(nonMatchingFile, diffContent))
7278

73-
expect(firstFailureError(await strategy.applyDiff(nonMatchingFile, diffContent))).toContain("LIKELY CAUSE")
79+
expect(errorText.includes("LIKELY CAUSE")).toBe(hinted)
7480
})
7581

7682
it.each(["value:3", ":3 trailing", "x start_line:3"])(

0 commit comments

Comments
 (0)