tests: verify tracked d3d12/docs/switches.md matches d3d12_switches.py --check

This commit is contained in:
bobcatchris
2026-12-01 13:56:28 -06:00
parent ab374c7d5e
commit 2190bf988f

View File

@ -2,7 +2,7 @@
python -I tests/test_d3d12_switches.py
Sources written by hand here; the last test runs on the repository's own. No build, no GPU, no game files.
Sources written by hand here; CommandTest runs on the repository's own. No build, no GPU, no game files.
"""
import contextlib
import io
@ -171,6 +171,20 @@ class CommandTest(unittest.TestCase):
# A moved folder must not turn the list into an empty one.
self.assertGreater(data.count(b"| `LEONIDA_"), 300)
def test_the_tracked_switches_page_matches_the_sources(self):
switches = os.path.join(ROOT, "d3d12", "docs", "switches.md")
out, err = io.StringIO(), io.StringIO()
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
code = ds.main(["--root", ROOT, "--check", switches])
self.assertEqual(
code,
0,
"d3d12/docs/switches.md is out of date (regenerate with "
"`python -I tools/d3d12_switches.py --out d3d12/docs/switches.md`):\n"
+ out.getvalue()
+ err.getvalue(),
)
if __name__ == "__main__":
unittest.main()