From 830e7c5d27d161b91402414e6ecd49f1ed818bfb Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 27 Mar 2026 08:48:05 +0100 Subject: Initial commit --- lib/configuration/tests/tree.t | 161 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 lib/configuration/tests/tree.t (limited to 'lib/configuration/tests/tree.t') 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 < { + > "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 < { + > "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 < { + > "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 < { + > "content": [ + > { + > "id": "entity", + > "subcontent": [ + > { + > "id": "details", + > "section": [ + > { + > "field": [ + > { + > "name": "entities", + > "label": {}, + > "type": { "content": "entity", } + > } + > ] + > } + > ] + > } + > ] + > } + > ] + > } + > EOF + digraph G { + entity; + + + entity -> entity; + + } + + -- cgit v1.2.3