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/model/tests/parent.t | |
Initial commit
Diffstat (limited to 'lib/model/tests/parent.t')
| -rw-r--r-- | lib/model/tests/parent.t | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/lib/model/tests/parent.t b/lib/model/tests/parent.t new file mode 100644 index 0000000..8e77578 --- /dev/null +++ b/lib/model/tests/parent.t @@ -0,0 +1,91 @@ + +A root content does not have any parent + + $ tests -parent "entity" <<EOF + > { + > "content": [ + > { + > "id": "entity" + > } + > ] + > } + > EOF + [No parent] + +A root content is the root of itself + + $ tests -parent -root "entity" <<EOF + > { + > "content": [ + > { + > "id": "entity" + > } + > ] + > } + > EOF + "entity" + +The parent of a subcontent shall never been None, and will target the container + + $ tests -parent "details" <<EOF + > { + > "content": [ + > { + > "id": "entity", + > "subcontent": [ + > { + > "id": "details" + > } + > ] + > } + > ] + > } + > EOF + "entity" + +The parent element can be a subcontent itself + + $ tests -parent "level2" <<EOF + > { + > "content": [ + > { + > "id": "entity", + > "subcontent": [ + > { + > "id": "level1", + > "subcontent": [ + > { + > "id": "level2" + > } + > ] + > } + > ] + > } + > ] + > } + > EOF + "level1" + +The root element is the top content + + $ tests -parent -root "level2" <<EOF + > { + > "content": [ + > { + > "id": "entity", + > "subcontent": [ + > { + > "id": "level1", + > "subcontent": [ + > { + > "id": "level2" + > } + > ] + > } + > ] + > } + > ] + > } + > EOF + "entity" + |
