feat(md2doc): add skeleton — argparse, STYLES dict, stub converter
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
"""CLI tests for md2doc.py — argparse interface, no actual conversion."""
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
REPO = Path(__file__).parent.parent
|
||||
|
||||
|
||||
def run_cli(*args):
|
||||
return subprocess.run(
|
||||
[sys.executable, "md2doc.py", *args],
|
||||
cwd=REPO, capture_output=True, text=True
|
||||
)
|
||||
|
||||
|
||||
def test_no_args_shows_usage():
|
||||
r = run_cli()
|
||||
assert r.returncode != 0
|
||||
assert "usage:" in r.stderr.lower()
|
||||
|
||||
|
||||
def test_nonexistent_input_exits_1():
|
||||
r = run_cli("nonexistent.md")
|
||||
assert r.returncode == 1
|
||||
assert "not found" in r.stderr.lower()
|
||||
|
||||
|
||||
def test_style_choices_listed_in_help():
|
||||
r = run_cli("--help")
|
||||
assert r.returncode == 0
|
||||
for s in ("elegant", "default", "dark", "mono", "report"):
|
||||
assert s in r.stdout
|
||||
|
||||
|
||||
def test_invalid_style_rejected():
|
||||
tmp = REPO / "tests" / "tmp_test.md"
|
||||
tmp.write_text("# test\n")
|
||||
try:
|
||||
r = run_cli(str(tmp), "--style", "nonexistent")
|
||||
assert r.returncode != 0
|
||||
finally:
|
||||
tmp.unlink()
|
||||
Reference in New Issue
Block a user