Skip to content
Snippets Groups Projects
Commit 428de240 authored by florian's avatar florian
Browse files

TST: Add test for multiple circular macro definitions

parent f9ac6218
Branches
Tags
2 merge requests!53Release 0.1,!25F macros
Pipeline #28934 failed
......@@ -249,3 +249,38 @@ testnode:
assert dat["testnode"]["obl"]["replaced1"]["c"]["t2"] == "25"
assert dat["testnode"]["obl"]["replaced1"]["d"][0] == "a"
assert dat["testnode"]["obl"]["replaced1"]["d"][1] == "25"
def test_circular_macro_definition(register_macros, macro_store_reset):
"""Test the (ab-)use of macros to create an infinite loop."""
cfood = _temp_file_load("""
---
metadata:
macros:
- !defmacro
name: test_one
params: {}
definition: !macro
test_two:
- !defmacro
name: test_two
params: {}
definition: !macro
test_one:
- !defmacro
name: test_three
params: {}
definition: !macro
test_two:
---
extroot: !macro
test_one:
extroot2: !macro
test_three:
""")
# macros in macros can be used, but there are no circles; they stop at the first one.
assert "test_one" not in cfood["extroot"]
assert cfood["extroot"]["test_two"] is None
assert "test_three" not in cfood["extroot2"]
assert "test_one" not in cfood["extroot2"]
assert cfood["extroot2"]["test_two"] is None
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment