test_diff_range_that_looks_like_an_option_is_refused

Tests › tests/guard/test_guard_git.py

passed Passed in the packaged run.

What this test is for

Why it exists

git diff supports --output=<file>, an arbitrary write primitive.

Given

  1. called: list[list[str]] = []
  2. def capture(cmd): called.append(cmd) return ""
→

When

  1. get_diff("a.c", "--output=/tmp/pwned", capture)
→

Then

  1. ✓ get_diff("a.c", "--output=/tmp/pwned", capture) is None
  2. ✓ called equals []

tests/guard/test_guard_git.py:258 · its file's page

What it checks (2)

  1. assert get_diff("a.c", "--output=/tmp/pwned", capture) is None observes get_diff
  2. assert called == [] not attributed

Where the product reaches it

  • main → _run → run_precommit → impact_report → collect_changes → _collect_changed_lines → _get_file_diff → get_diff (flow)

Call flow

test_diff_range_that_looks_like_an_option_is_refused→get_diff

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

test_diff_range_that_looks_like_an_option_is_refused · 2 checksget_diffrun_gitgit_argvREQ-DDB-CONFIG-001 · inferredget_diffREQ-DDB-GUARD-023 · measured
Also reaches 2 requirements

Its run touches their code; that is reach, not proof.