summaryrefslogtreecommitdiff
path: root/tests/test_rules/EXPRESSIONS
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-12-09 15:24:55 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2022-12-12 14:46:19 +0100
commit886c7b680928276d7f925d30fc206ca27d9a97d1 (patch)
tree4471690974cc15caad524274c88fff830bf2c127 /tests/test_rules/EXPRESSIONS
parent6e10ee13df0b83511d7fe94bb755ac53f993c0ec (diff)
downloadrules-cc-886c7b680928276d7f925d30fc206ca27d9a97d1.tar.gz
Add tests and readme
Diffstat (limited to 'tests/test_rules/EXPRESSIONS')
-rw-r--r--tests/test_rules/EXPRESSIONS46
1 files changed, 46 insertions, 0 deletions
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"}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}