"""Tests for README documentation consistency.

This module contains tests that verify the README.md file contains
accurate and up-to-date information about command-line switches and options.
"""

import subprocess


def test_():
    """Test that README.md contains the current CLI help text.

    Verifies that the help text generated by the CLI module matches
    what is documented in the README.md file, ensuring documentation
    stays synchronized with the actual implementation.
    """
    with open("README.md", "r") as f:
        readme = f.read()

    result = subprocess.run(
        ["python", "-m", "subwiz.cli", "-h"],
        capture_output=True,
        text=True,
        env={**dict(subprocess.os.environ), "COLUMNS": "100"},
    )
    help_text = result.stdout

    print(help_text)

    assert help_text in readme
