test_staleness_detects_an_unbumped_rust_body

Tests › tests/guard/test_guard_rust.py

passed Passed in the packaged run.

What this test is for

Why it exists

The test says nothing about why.

Given

  1. config = _rust_config()
  2. head = "/// Summary.\n/// @version 1\nfn f() -> u8 {\n 1\n}\n"
  3. edited = head.replace(" 1", " 2")
→

When

  1. head_funcs = parse_content_for_file("lib.rs", head, config)
  2. funcs = parse_content_for_file("lib.rs", edited, config)
  3. (violation,) = check_version_staleness(funcs, "lib.rs", config, edited, head_funcs, head)
3 more
  1. bumped = edited.replace("@version 1", "@version 2")
  2. funcs = parse_content_for_file("lib.rs", bumped, config)
  3. check_version_staleness(funcs, "lib.rs", config, bumped, head_funcs, head)
→

Then

  1. ✓ violation.check equals "version"
  2. ✓ check_version_staleness(funcs, "lib.rs", config, bumped, head_funcs, head) equals []

What it exercises

The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.

`main` (clew/guard/main.py) · 52 of 357 steps

… 41 earlier steps

program launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyloop (line 793)loopopt (line 795)optloop (line 651)loopopt (line 653)optopt (line 733)optmain42–43. load_config → _fresh_defaults42_fresh_defaults +1 more44. apply_opt_in_languages → deep_merge44deep_merge▶ test enters45. deep_merge → deep_merge45deep_merge46. load_config → deep_merge46deep_merge47. _run → run_precommit47run_precommit

… 56 steps between

program launcherprogram launcherprogram launcherprogram launcherprogram launcherclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyother filesother filesother filesother filesother filesopt (line 168)optopt (line 786)optloop (line 647)loopopt (line 652)optmain104–105. parse_source_file → parse_source_file_with_content104parse_source_file_with_content +1 more106. parse_content_for_file → get_language_config106get_language_config▶ test enters107. get_language_config → get_validate107get_validate108–109. parse_content_for_file → resolve_parse_settings108resolve_parse_settings +1 more110. parse_content_for_file → language_for_file110language_for_file111–112. language_for_file → language_for_extension111language_for_extension +1 more113. language_for_file → _language_from_config113_language_from_config114. parse_content_for_file → parse_functions114parse_functions115. parse_functions → parse_functions_ts115parse_functions_ts116. parse_functions_ts → get_parser_for_language116get_parser_for_language117. parse_functions_ts → get_language_spec117get_language_spec118–121. parse_functions_ts → _collect_functions118_collect_functions +3 more122. _enclosing_class_for → _rust_impl_self_type122_rust_impl_self_type123. _collect_functions → _declared_function123_declared_function124–125. _collect_functions → _append_declaration124_append_declaration +1 more

… 1 step between

program launcherprogram launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyother filesother filesother filesother filesother filesloop (line 647)loopopt (line 658)optelif (line 379)elifopt (line 400)optopt (line 681)optopt (line 683)optalt (line 684)altopt (line 227)opttry (line 241)trymain127–128. _append_declaration → _qualified_enclosing127_qualified_enclosing +1 more129–132. _collect_functions → _resolve_function_node129_resolve_function_node +3 more133. _extract_function_name → _name_from_declarator133_name_from_declarator134–139. _collect_functions → _function_carrier134_function_carrier +5 more140–142. _find_preceding_doxygen → _collect_python_comments140_collect_python_comments +2 more143. _find_preceding_doxygen → parse_doxygen_tags143parse_doxygen_tags144. _find_preceding_doxygen → apply_autobrief144apply_autobrief145. _find_preceding_doxygen → _last_row145_last_row146–149. _collect_functions → _qualified_enclosing146_qualified_enclosing +3 more150. _js_returns_void → _function_carrier150_function_carrier151. _collect_functions → _produced_class151_produced_class152. _produced_class → _function_carrier152_function_carrier153. _collect_functions → _collect_functions153_collect_functions154. _collect_functions → _collect_functions154_collect_functions155. validate_file → unconfigured_language155unconfigured_language156. validate_file → check_file_presence156check_file_presence

… 6 steps between

program launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyother filesother filesother filesother filesopt (line 1198)optloop (line 143)looploop (line 146)loopelif (line 153)elifopt (line 1171)optloop (line 181)loopmain163. _extract_file_block_text → _docstring_block163_docstring_block164. _check_file_block_tags → parse_doxygen_tags164parse_doxygen_tags165–168. parse_doxygen_tags → _mask_escaped_at165_mask_escaped_at +3 more169. parse_doxygen_tags → _finalize_tag169_finalize_tag170. parse_doxygen_tags → _finalize_tag170_finalize_tag171. _check_file_block_tags → apply_autobrief171apply_autobrief172–174. apply_autobrief → _mask_escaped_at172_mask_escaped_at +2 more175. validate_file → check_presence175check_presence176. check_presence → get_validate176get_validate

… 55 steps between

program launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyopt (line 265)optloop (line 458)looploop ×2 (line 459)loop ×2main232. validate_file → parse_content_for_file232parse_content_for_file233. validate_file → check_version_staleness233check_version_staleness234. check_version_staleness → get_validate234get_validate▶ test enters235–237. check_version_staleness → _index_by_identity235_index_by_identity +2 more238–239. _pair_copies → _body_text238_body_text ×2240. _pair_copies → 240… 1 call not run241–243. check_version_staleness → _pair_by_name241_pair_by_name +2 more244. _validate_files → _report_skips244_report_skips245. run_precommit → report_dir245report_dir

… 112 later steps

tests/guard/test_guard_rust.py:172 · its file's page

What it checks (2)

  1. assert violation.check == "version" not attributed
  2. assert check_version_staleness(funcs, "lib.rs", config, bumped, head_funcs, head) == [] observes check_version_staleness

Where the product reaches it

  • main → _run → run_precommit → _validate_files → validate_file → check_version_staleness (flow)
  • main → _run → run_precommit → _validate_files → validate_file → parse_content_for_file (flow)

Call flow

test_staleness_detects_an_unbumped_rust_body→_rust_config→parse_content_for_file→check_version_staleness

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_staleness_detects_an_unbumped_rust_body · 2 checkscheck_version_stalenessREQ-DDB-GUARD-002 · measuredparse_content_for_fileget_language_configREQ-DDB-GUARD-013 · measuredparse_content_for_fileREQ-DDB-GUARD-018 · measuredparse_content_for_file… 4 calls …parse_doxygen_tagsREQ-DDB-GUARD-019 · measuredparse_content_for_filelanguage_for_fileREQ-DDB-GUARD-020 · measuredparse_content_for_file… 4 calls …_find_python_docstring_blockREQ-DDB-GUARD-021 · inferred_rust_configapply_opt_in_languagesREQ-DDB-GUARD-024 · measuredparse_content_for_file… 3 calls …_js_returns_voidREQ-DDB-GUARD-025 · measured
Also reaches 8 requirements

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