Fix dollar sign replacement bug in file editing (#7703)

This commit is contained in:
fuyou
2025-09-05 10:12:57 +08:00
committed by GitHub
parent aea6230bcc
commit 0bc0d23cb3
6 changed files with 68 additions and 23 deletions
+16
View File
@@ -198,6 +198,22 @@ describe('EditTool', () => {
'hello world',
);
});
it('should treat $ literally and not as replacement pattern', () => {
const current = "price is $100 and pattern end is ' '";
const oldStr = 'price is $100';
const newStr = 'price is $200';
const result = applyReplacement(current, oldStr, newStr, false);
expect(result).toBe("price is $200 and pattern end is ' '");
});
it("should treat $' literally and not as a replacement pattern", () => {
const current = 'foo';
const oldStr = 'foo';
const newStr = "bar$'baz";
const result = applyReplacement(current, oldStr, newStr, false);
expect(result).toBe("bar$'baz");
});
});
describe('validateToolParams', () => {