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

This commit is contained in:
Gal Zahavi
2025-09-05 13:34:02 -07:00
committed by GitHub
parent 20d0de74e1
commit 0e284457be
6 changed files with 23 additions and 68 deletions
+1 -17
View File
@@ -46,11 +46,11 @@ import {
type Mock,
} from 'vitest';
import {
applyReplacement,
SmartEditTool,
type EditToolParams,
calculateReplacement,
} from './smart-edit.js';
import { applyReplacement } from './edit.js';
import { type FileDiff, ToolConfirmationOutcome } from './tools.js';
import { ToolErrorType } from './tool-error.js';
import path from 'node:path';
@@ -169,22 +169,6 @@ describe('SmartEditTool', () => {
'hello new world new',
);
});
it('should treat $ literally and not as replacement pattern', () => {
const current = 'regex end is $ and more';
const oldStr = 'regex end is $';
const newStr = 'regex end is $ and correct';
const result = applyReplacement(current, oldStr, newStr, false);
expect(result).toBe('regex end is $ and correct and more');
});
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('calculateReplacement', () => {