summaryrefslogtreecommitdiff
path: root/lib/configuration/tests/tree.t
diff options
context:
space:
mode:
Diffstat (limited to 'lib/configuration/tests/tree.t')
-rw-r--r--lib/configuration/tests/tree.t161
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;
+
+ }
+
+