From 3712a7a30b748d228903cfea29e7bf227eab7883 Mon Sep 17 00:00:00 2001 From: agentson Date: Mon, 2 Mar 2026 01:30:02 +0900 Subject: [PATCH] test: cover governance newline-helper required tokens --- tests/test_validate_governance_assets.py | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/test_validate_governance_assets.py b/tests/test_validate_governance_assets.py index 3f2ff21..5bb023e 100644 --- a/tests/test_validate_governance_assets.py +++ b/tests/test_validate_governance_assets.py @@ -187,3 +187,57 @@ def test_validate_read_only_approval_skips_when_no_readonly_file_changed() -> No module.validate_read_only_approval(changed_files, errors, warnings) assert errors == [] assert warnings == [] + + +def test_must_contain_enforces_workflow_newline_helper_tokens(tmp_path) -> None: + module = _load_module() + workflow_doc = tmp_path / "workflow.md" + workflow_doc.write_text( + "\n".join( + [ + "Session Handover Gate (Mandatory)", + "python3 scripts/session_handover_check.py --strict", + "scripts/tea_comment.sh", + ] + ), + encoding="utf-8", + ) + errors: list[str] = [] + module.must_contain( + workflow_doc, + [ + "Session Handover Gate (Mandatory)", + "session_handover_check.py --strict", + "scripts/tea_comment.sh", + ], + errors, + ) + assert errors == [] + + +def test_must_contain_enforces_commands_newline_section_tokens(tmp_path) -> None: + module = _load_module() + commands_doc = tmp_path / "commands.md" + commands_doc.write_text( + "\n".join( + [ + "Session Handover Preflight (Mandatory)", + "python3 scripts/session_handover_check.py --strict", + "Comment Newline Escaping", + "scripts/tea_comment.sh", + ] + ), + encoding="utf-8", + ) + errors: list[str] = [] + module.must_contain( + commands_doc, + [ + "Session Handover Preflight (Mandatory)", + "session_handover_check.py --strict", + "Comment Newline Escaping", + "scripts/tea_comment.sh", + ], + errors, + ) + assert errors == []