upravy skillu

This commit is contained in:
lachtan
2026-09-02 15:22:39 +02:00
parent 63089cb8cb
commit 442ddc3c24
5 changed files with 177 additions and 104 deletions

View File

@@ -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