mirror of
https://github.com/NCBM/plyngent.git
synced 2026-11-07 15:37:55 +08:00
core/tools: edit results preview the old content
Wrong-target edits (the test_run_aside pass clobber, the edit_replace
mangling) were silent: the success message reported counts only, so the
model had no signal it replaced the wrong thing until later.
edit_lineno now reports the first removed line ("first: 'pass'") and
edit_replace reports the matched pattern ('old' -> 'new'), giving the
model an immediate self-correction signal.
This commit is contained in:
@@ -19,6 +19,7 @@ def test_edit_lineno_replace_middle(workspace: object) -> None:
|
||||
_ = _read_lineno("a.txt")
|
||||
out = call_sync(edit_lineno, "a.txt", 2, 3, "TWO\nTHREE\n")
|
||||
assert "replaced lines 2-3" in out
|
||||
assert "first: 'two'" in out # old-content excerpt for self-correction
|
||||
assert call_sync(read_file, "a.txt") == "L1-4\none\nTWO\nTHREE\nfour\n"
|
||||
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ def test_edit_replace_first_only(workspace: object) -> None:
|
||||
assert call_sync(read_file, "t.txt") == "L1-1\nbb aa"
|
||||
assert "1 of 2" in result or "1 of 2 matches" in result
|
||||
assert "remain" in result
|
||||
assert "'aa' → 'bb'" in result # old→new excerpt for self-correction
|
||||
|
||||
|
||||
def test_edit_replace_max_replaces(workspace: object) -> None:
|
||||
|
||||
Reference in New Issue
Block a user