upravy skillu
This commit is contained in:
@@ -189,6 +189,20 @@ class TestCheckAndReject:
|
||||
assert "-If the fetch fails, try again." in printed
|
||||
assert "+If the fetch fails, STOP and diagnose." in printed
|
||||
|
||||
def test_check_previews_the_users_own_rewrite(self, workspace, tmp_path, capsys):
|
||||
"""`edit:` shows the user's wording as a diff first, so --check has to take it too —
|
||||
without --check the same flag applies and commits straight away."""
|
||||
replacement = tmp_path / "new.txt"
|
||||
replacement.write_text("If the fetch fails, ask the user.", encoding="utf-8")
|
||||
exit_code = reflect_apply.main(
|
||||
["--id", "f7a2", "--check", "--new-text-file", str(replacement), "--workspace", str(workspace)]
|
||||
)
|
||||
|
||||
assert exit_code == 0
|
||||
assert "+If the fetch fails, ask the user." in capsys.readouterr().out
|
||||
assert (workspace / TARGET_REL).read_text(encoding="utf-8") == ORIGINAL
|
||||
assert _findings(workspace)[0]["status"] == "open"
|
||||
|
||||
def test_check_fails_on_a_stale_patch(self, workspace):
|
||||
_write_findings(workspace, _record(patch={**_record()["patch"], "old_text": "absent"}))
|
||||
assert reflect_apply.main(["--id", "f7a2", "--check", "--workspace", str(workspace)]) == 2
|
||||
|
||||
Reference in New Issue
Block a user