16 lines
805 B
Python
16 lines
805 B
Python
# Docs snippets (tools/fixtures.py): every ```luau block of docs/guide/*.md and every examples/*.luau becomes a test
|
|
# under tests/docs/snippets/ (tools/docs_check.py explains the markers). Generated here so `bash tools/test.sh`
|
|
# always tests the pages as they are; the inputs the snippets read come from tools/fixtures/docs_*.py.
|
|
import importlib.util, os
|
|
|
|
INPUTS = ["docs/guide", "examples", "tools/docs_check.py"]
|
|
|
|
|
|
def generate(ctx):
|
|
spec = importlib.util.spec_from_file_location("docs_check", os.path.join(ctx.root, "tools", "docs_check.py"))
|
|
dc = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(dc)
|
|
paths, nrun, nshow, nex = dc.generate()
|
|
print("fixtures: docs: %d snippets to run, %d display-only, %d examples" % (nrun, nshow, nex))
|
|
ctx.outputs.extend(paths)
|