diff options
| author | Sébastien Dailly <sebastien@dailly.me> | 2026-03-27 08:48:05 +0100 |
|---|---|---|
| committer | Sébastien Dailly <sebastien@dailly.me> | 2026-03-27 08:48:05 +0100 |
| commit | 830e7c5d27d161b91402414e6ecd49f1ed818bfb (patch) | |
| tree | 448864635d29b1ea66424cbb9e0816fbcf1e1907 /lib/configuration/tests/tree.t | |
Initial commit
Diffstat (limited to 'lib/configuration/tests/tree.t')
| -rw-r--r-- | lib/configuration/tests/tree.t | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/lib/configuration/tests/tree.t b/lib/configuration/tests/tree.t new file mode 100644 index 0000000..b69c830 --- /dev/null +++ b/lib/configuration/tests/tree.t @@ -0,0 +1,161 @@ +This test display the dependency tree between root contents after loading the +configuration. + +Each reference field introduce a dependency between the content having the field +and the content targeted by the field. + + $ tests -configuration -tree <<EOF + > { + > "content": [ + > { + > "id": "entity", + > "section": [ + > { + > "field": [ + > { + > "name": "user_type", + > "label": {}, + > "type": { + > "content": "user_type_list", + > "multivaluated": true + > } + > } + > ] + > } + > ] + > }, + > { + > "id": "user_type_list" + > } + > ] + > } + > EOF + digraph G { + entity; + user_type_list; + + + entity -> user_type_list; + + } + +The tree only contains root elements. Links between subcontent are reported as +link between their respective root content. + + $ tests -configuration -tree <<EOF + > { + > "content": [ + > { + > "id": "entity", + > "subcontent": [ + > { + > "id": "details", + > "section": [ + > { + > "field": [ + > { + > "name": "user_type", + > "label": {}, + > "type": { + > "content": "user_type_list", + > } + > } + > ] + > } + > ] + > } + > ] + > }, + > { + > "id": "user_type_list" + > } + > ] + > } + > EOF + digraph G { + entity; + user_type_list; + + + entity -> user_type_list; + + } + + $ tests -configuration -tree <<EOF + > { + > "content": [ + > { + > "id": "entity", + > "subcontent": [ + > { + > "id": "details", + > "section": [ + > { + > "field": [ + > { + > "name": "reference", + > "label": {}, + > "type": { "content": "user-details", } + > } + > ] + > } + > ] + > } + > ] + > }, + > { + > "id": "user_type_list", + > "subcontent": [ + > { + > "id": "user-details", + > } + > ] + > } + > ] + > } + > EOF + digraph G { + entity; + user_type_list; + + + entity -> user_type_list; + + } + +A content is allowed to loop to itself, directly or indirectly: + + $ tests -configuration -tree <<EOF + > { + > "content": [ + > { + > "id": "entity", + > "subcontent": [ + > { + > "id": "details", + > "section": [ + > { + > "field": [ + > { + > "name": "entities", + > "label": {}, + > "type": { "content": "entity", } + > } + > ] + > } + > ] + > } + > ] + > } + > ] + > } + > EOF + digraph G { + entity; + + + entity -> entity; + + } + + |
