Add the corpus tests.

This commit is contained in:
David Given
2023-10-27 20:43:46 +02:00
parent 6038a11671
commit 5af0b68e06
6 changed files with 155 additions and 62 deletions

View File

@@ -1,4 +1,4 @@
from build.ab import Rule, normalrule, Target, filenameof
from build.ab import Rule, normalrule, Target, filenameof, Targets
from os.path import basename
@@ -14,11 +14,30 @@ def objectify(self, name, src: Target, symbol):
@Rule
def test(self, name, command: Target):
normalrule(
replaces=self,
ins=[command],
outs=["sentinel"],
commands=["{ins[0]}", "touch {outs}"],
label="TEST",
)
def test(
self,
name,
command: Target = None,
commands=None,
ins: Targets = [],
deps: Targets = [],
label="TEST",
):
if command:
normalrule(
replaces=self,
ins=[command],
outs=["sentinel"],
commands=["{ins[0]}", "touch {outs}"],
deps=deps,
label=label,
)
else:
normalrule(
replaces=self,
ins=ins,
outs=["sentinel"],
commands=commands + ["touch {outs}"],
deps=deps,
label=label,
)