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/errors.t | |
Initial commit
Diffstat (limited to 'lib/configuration/tests/errors.t')
| -rw-r--r-- | lib/configuration/tests/errors.t | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/lib/configuration/tests/errors.t b/lib/configuration/tests/errors.t new file mode 100644 index 0000000..6b5584e --- /dev/null +++ b/lib/configuration/tests/errors.t @@ -0,0 +1,119 @@ +Differents invalid configuration. All of them shall report the error properly + +Every content shall have an identifier + + $ tests -configuration <<EOF + > { + > "content": [ + > { + > "key": "", + > } + > ] + > } + > EOF + in field "content": + while decoding a list: + element 0: + Expected an object with an attribute "id", but got { "key": "" } + +The content ID cannot be empty: + + $ tests -configuration <<EOF + > { + > "content": [ + > { + > "id": "", + > } + > ] + > } + > EOF + in field "content": + while decoding a list: + element 0: in field "id": Expected a non empty identifier, but got "" + +The content ID cannot be contains "." (this charater is used internaly): + + $ tests -configuration <<EOF + > { + > "content": [ + > { + > "id": "foo.bar", + > } + > ] + > } + > EOF + in field "content": + while decoding a list: + element 0: + in field "id": + Expected an identifier with only the accepted characters, but got + "foo.bar" + +A reference shall point to an existing content: + + $ tests -configuration <<EOF + > { + > "content": [ + > { + > "id": "content", + > "section": [ + > { + > "field": [ + > { + > "name": "name", + > "label": {}, + > "type": { + > "content": "yes_no" + > } + > } + > ] + > } + > ] + > } + > ] + > } + > EOF + Undefined target "yes_no". Expected existing list or content, but got + { "content": "yes_no" } + +Cycles between required content are not accepted + + $ tests -configuration <<EOF + > { + > "content": [ + > { + > "id": "entity", + > "section": [ + > { + > "field": [ + > { + > "name": "user_type", + > "label": {}, + > "required": true, + > "type": { + > "content": "user", + > "multivaluated": true, + > } + > } + > ] + > } + > ] + > }, + > { + > "id": "user", + > "section": [ + > { + > "field": [ + > { + > "name": "entity", + > "label": {}, + > "required": true, + > "type": { "content": "entity", } + > } + > ] + > } + > ] + > } + > ] + > } + Dependency circle found between: entity user |
