fix(coding-agent): corrected variable initialization order in formatPromptContent
- Corrected variable initialization order in formatPromptContent to prevent stale trimmedStart value when ASCII symbol replacement occurs. - Updated bash.md documentation to use ellipsis (...) instead of three dots (...) for consistency with ASCII symbol replacement behavior. - Added test case verifying table row compaction and content deduplication during pre-render with ASCII symbol replacement.
This commit is contained in:
@@ -43,4 +43,15 @@ describe("formatPromptContent renderPhase", () => {
|
||||
expect(preRender).toBe("<root>\n{{#if ok}}\nvalue\n{{/if}}\n</root>");
|
||||
expect(postRender).toBe("<root>\n{{#if ok}}\nvalue\n\n{{/if}}\n</root>");
|
||||
});
|
||||
test("pre-render compacts table rows and does not duplicate content when replacing ascii", () => {
|
||||
const input =
|
||||
'|`cat <<\'EOF\' > file`|`write(path="file", content="...")`|\n|`sed -i \'s/old/new/\' file`|`edit(path="file", edits=[...])`|';
|
||||
const output = formatPromptContent(input, {
|
||||
renderPhase: "pre-render",
|
||||
replaceAsciiSymbols: true,
|
||||
});
|
||||
expect(output).toBe(
|
||||
'|`cat <<\'EOF\' > file`|`write(path="file", content="…")`|\n|`sed -i \'s/old/new/\' file`|`edit(path="file", edits=[…])`|',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user