From 886c7b680928276d7f925d30fc206ca27d9a97d1 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Fri, 9 Dec 2022 15:24:55 +0100 Subject: Add tests and readme --- tests/test_rules/EXPRESSIONS | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/test_rules/EXPRESSIONS (limited to 'tests/test_rules/EXPRESSIONS') diff --git a/tests/test_rules/EXPRESSIONS b/tests/test_rules/EXPRESSIONS new file mode 100644 index 0000000..f1ca6f4 --- /dev/null +++ b/tests/test_rules/EXPRESSIONS @@ -0,0 +1,46 @@ +{ "stage_singleton_field": + { "vars": ["fieldname", "transition", "location"] + , "expression": + { "type": "assert_non_empty" + , "msg": + ["No artifact specified in field", {"type": "var", "name": "fieldname"}] + , "$1": + { "type": "disjoint_map_union" + , "msg": + [ "Expecting (essentially) a single artifact in field" + , {"type": "var", "name": "fieldname"} + ] + , "$1": + { "type": "foreach" + , "var": "src" + , "range": + {"type": "FIELD", "name": {"type": "var", "name": "fieldname"}} + , "body": + { "type": "disjoint_map_union" + , "$1": + { "type": "foreach" + , "var": "artifact" + , "range": + { "type": "values" + , "$1": + { "type": "DEP_ARTIFACTS" + , "dep": {"type": "var", "name": "src"} + , "transition": + { "type": "var" + , "name": "transition" + , "default": {"type": "empty_map"} + } + } + } + , "body": + { "type": "singleton_map" + , "key": {"type": "var", "name": "location"} + , "value": {"type": "var", "name": "artifact"} + } + } + } + } + } + } + } +} -- cgit v1.2.3