fix(files): reject no-op edits

This commit is contained in:
chengyongru
2026-08-10 21:39:00 +08:00
committed by chengyongru
parent c281e090d0
commit b3b0517611
2 changed files with 16 additions and 2 deletions
+10
View File
@@ -133,6 +133,16 @@ class TestEditFileTool:
assert "Successfully" in result
assert f.read_text() == "hello earth"
@pytest.mark.asyncio
async def test_identical_replacement_returns_clear_error(self, tool, tmp_path):
f = tmp_path / "a.py"
f.write_text("hello world", encoding="utf-8")
result = await tool.execute(path=str(f), old_text="world", new_text="world")
assert result == "Error: new_text must be different from old_text."
assert f.read_text(encoding="utf-8") == "hello world"
@pytest.mark.asyncio
async def test_crlf_normalisation(self, tool, tmp_path):
f = tmp_path / "crlf.py"