test_lock_site_detects_rwlock_read_and_write

Tests › tests/test_rust_ast.py

passed Passed in the packaged run.

What this test is for

Why it exists

The test says nothing about why.

Given

  1. tree, src = _parse( "fn f(rw: &std::sync::RwLock<i32>) {\n" " let r = rw.read().unwrap();\n" " let w = rw.write().unwrap();\n" "}\n" )
→

When

  1. patterns = {p.name: p for p in load_lock_patterns(None)}
  2. sites = _walk_lock_sites(tree, src, patterns)
  3. kinds_modes = {(s[0], s[7]) for s in sites}
→

Then

  1. ✓ kinds_modes contains ("read", "shared")
  2. ✓ kinds_modes contains ("write", "exclusive")

tests/test_rust_ast.py:159 · its file's page

What it checks (2)

  1. assert ("read", "shared") in kinds_modes not attributed
  2. assert ("write", "exclusive") in kinds_modes not attributed

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_lock_site_detects_rwlock_read_and_write→_parse→load_lock_patterns→_walk_lock_sites

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_lock_site_detects_rwlock_read_and_write · 2 checks_walk_lock_sites… 3 calls …enclosingREQ-DDB-PIPE-003 · measuredload_lock_patternsREQ-DDB-SCHEMA-011 · measuredload_lock_patternsdeclaration_originREQ-DDB-SCHEMA-012 · measured
Also reaches 3 requirements

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