refactor: split rust test enumeration into its own module

rust_runner.py owns the #[test]/#[tokio::test] regex scan, mirroring
python_runner.py's split out of the old validate_ledger.py.
This commit is contained in:
Ishaan Jaff 2026-09-02 18:12:46 -07:00
parent 420a4811ab
commit ede610816c
No known key found for this signature in database

View file

@ -0,0 +1,13 @@
from __future__ import annotations
import re
from pathlib import Path
_RUST_TEST_PATTERN = re.compile(
r"#\[(?:test|tokio::test)\][^\n]*\n(?:[^\n]*\n)*?\s*(?:async\s+)?fn\s+(\w+)\s*\("
)
def enumerate_rust_tests(repo_root: Path, relative_path: str) -> frozenset[str]:
source = (repo_root / relative_path).read_text(encoding="utf-8")
return frozenset(match.group(1) for match in _RUST_TEST_PATTERN.finditer(source))