diff options
| author | Morgan Lunt <morganl@anthropic.com> | 2026-09-25 11:28:44 -0700 |
|---|---|---|
| committer | Morgan Lunt <morganl@anthropic.com> | 2026-09-25 11:28:44 -0700 |
| commit | d49ccb3844876e35262a32f145b7b717646da733 (patch) | |
| tree | cbaefc469ac837a85ac154e797fff20dd1905d62 /plugins/code-modernization/scripts/tests/test_report_tools.py | |
| parent | d3a40f72165764888f9a57a3e93db86e88f8e063 (diff) | |
code-modernization: a rule is tested only if a test that ran backs it
A rule named only by a skipped or pending test no longer counts as covered. It is listed as "named, not run" and fails the rules check. A test-only folder is listed as tooling and gets no verdict. The verify command tries malformed records only when the person asked for exact behavior, so a proof loop has an end. The report parses rule headings and fields in linear time, and the report and pane show the new status.
Diffstat (limited to 'plugins/code-modernization/scripts/tests/test_report_tools.py')
| -rw-r--r-- | plugins/code-modernization/scripts/tests/test_report_tools.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/code-modernization/scripts/tests/test_report_tools.py b/plugins/code-modernization/scripts/tests/test_report_tools.py index 07c892bc..7d3acec4 100644 --- a/plugins/code-modernization/scripts/tests/test_report_tools.py +++ b/plugins/code-modernization/scripts/tests/test_report_tools.py @@ -293,6 +293,18 @@ class BuildFacts(unittest.TestCase): self.assertEqual(blocks[0]["k"], "md") self.assertEqual(br.parse_rules("just text\n\n## Heading")[0]["k"], "md") + def test_headings_and_fields_padded_with_thousands_of_spaces_are_parsed_in_a_moment(self): + import time + pad = " " * 6000 + text = "### RULE-001 - Title%s#%sx\n**Priority:** P0%s\n**Suspected defect:**%s\n\n### RULE-002: Closed ### \n**Priority:** P1 \n" % (pad, pad, pad, pad) + started = time.time() + cards = [c for c in br.parse_rules(text) if c["k"] == "rule"] + self.assertLess(time.time() - started, 2) + self.assertEqual([c["id"] for c in cards], ["RULE-001", "RULE-002"]) + self.assertEqual(cards[1]["title"], "Closed") + self.assertEqual(cards[1]["p"], "P1") + self.assertEqual(br.field("Priority: \nPriority: P2 ", "Priority"), "P2") + def test_rule_priority_falls_back_to_the_index_table(self): text = "| ID | Name | Priority |\n|---|---|---|\n| [RULE-007](#x) | Merged | P0 |\n\n### RULE-007: Merged\n**Merged into:** RULE-006\n\n### RULE-008: Real\n**Priority:** P1\n" cards = [b for b in br.parse_rules(text) if b["k"] == "rule"] |
