test_an_explicit_list_keeps_the_declared_config_header

Tests › tests/test_preprocessor.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE ACCEPTANCE BUILD DISCARDED ITS OWN DECLARED HEADER ON EVERY RUN. `resolve_preprocessor` returned on `if explicit:` before reading the declaration at all, so a `config_header:` stated in the SAME section as `predefined:` was silently dropped the moment a macro list was passed — and `clew/cli.py` promotes a declared `predefined:` to exactly that argument. An accepted-but-unread key is this project's most repeated defect; this was an instance.

Given

  1. root = tmp_path / "repo"
  2. (root / "include").mkdir(parents=True)
2 more
  1. (root / "include" / "config.h").write_text( "#define SHIPPED_ON 1\n//#define SHIPPED_OFF\n", encoding="utf-8" )
  2. declaration = { SECTION_PREPROCESSOR: { "predefined": ["SHIPPED_OFF"], "config_header": "include/config.h", } }
→

When

  1. config = resolve_preprocessor(root, declaration, explicit=["SHIPPED_OFF"])
  2. both = resolve_preprocessor(root, declaration, explicit=["SHIPPED_OFF", "SHIPPED_ON"])
→

Then

  1. ✓ config.source equals SOURCE_FLAG
  2. ✓ config.macros equals ('"SHIPPED_OFF"',)
  3. ✓ config.config_header equals "include/config.h"
  4. ✓ config.stated_only equals ("SHIPPED_OFF",)
  5. ✓ both.stated_only equals ("SHIPPED_OFF",)

tests/test_preprocessor.py:806 · its file's page

What it checks (5)

  1. assert config.source == SOURCE_FLAG, "an explicit list still wins outright" observes resolve_preprocessor via config
  2. assert config.macros == ('"SHIPPED_OFF"',), ( f"the override must replace the macro list, not merge the header into it; got " f"{config.macros}" ) observes resolve_preprocessor via config
  3. assert config.config_header == "include/config.h", ( "the declared header was discarded by the explicit branch — the defect this test exists " "for. It is a fact about the repository and survives an override of the macro list." ) observes resolve_preprocessor via config
  4. assert config.stated_only == ("SHIPPED_OFF",), ( f"`stated_only` must name the overridden macros the header does not define, which is what " f"lets the reply say they ship OFF; got {config.stated_only}" ) observes resolve_preprocessor via config
  5. assert both.stated_only == ("SHIPPED_OFF",), ( f"SHIPPED_ON is defined in the header, so it must not be listed as operator-only; got " f"{both.stated_only}" ) observes resolve_preprocessor via both

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_an_explicit_list_keeps_the_declared_config_header→resolve_preprocessor

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_an_explicit_list_keeps_the_declared_config_header · 5 checksresolve_preprocessorREQ-DDB-CONFIG-004 · measuredresolve_preprocessor_resolve_config_header_named_config_headerwithin_repoREQ-DDB-PIPE-014 · measured
Also reaches 2 requirements

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