summaryrefslogtreecommitdiff
path: root/lib/configuration/tests/errors.t
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2026-11-19 11:32:16 +0100
committerSébastien Dailly <sebastien@dailly.me>2026-11-19 11:32:16 +0100
commit8708171877054c98aad45079d85d4e699420f2fe (patch)
tree2e580e6891708b7b70d07f7bec03bd0a76ae171b /lib/configuration/tests/errors.t
parente1bf7686f408b52a870d4ed4f3c565dbbcc3954f (diff)
Added fields in lists
Diffstat (limited to 'lib/configuration/tests/errors.t')
-rw-r--r--lib/configuration/tests/errors.t103
1 files changed, 101 insertions, 2 deletions
diff --git a/lib/configuration/tests/errors.t b/lib/configuration/tests/errors.t
index 99ad465..b23f237 100644
--- a/lib/configuration/tests/errors.t
+++ b/lib/configuration/tests/errors.t
@@ -222,8 +222,7 @@ A list ID follows the same rules as a content ID:
> {
> "list": [
> {
- > "id": "foo.bar",
- > "source": "csv"
+ > "id": "foo.bar"
> }
> ],
> "content": []
@@ -235,3 +234,103 @@ A list ID follows the same rules as a content ID:
in field "id":
Expected an identifier with only the accepted characters, but got
"foo.bar"
+
+A reference field in a list can only target another list, not a content:
+
+ $ tests --configuration <<EOF
+ > {
+ > "list": [
+ > {
+ > "id": "user_type_list",
+ > "field": [
+ > {
+ > "name": "entity",
+ > "label": {},
+ > "type": { "content": "entity" }
+ > }
+ > ]
+ > }
+ > ],
+ > "content": [ { "id": "entity" } ]
+ > }
+ > EOF
+ in field "list":
+ while decoding a list:
+ element 0:
+ in field "field":
+ while decoding a list:
+ element 0:
+ in field "type":
+ I tried the following decoders but they all failed:
+ "text" decoder:
+ Expected a string, but got { "content": "entity" }
+ "content" decoder:
+ References in a list can only target a list declared before it, but got
+ { "content": "entity" }
+
+A list cannot reference itself:
+
+ $ tests --configuration <<EOF
+ > {
+ > "list": [
+ > {
+ > "id": "user_type_list",
+ > "field": [
+ > {
+ > "name": "parent",
+ > "label": {},
+ > "type": { "content": "user_type_list" }
+ > }
+ > ]
+ > }
+ > ],
+ > "content": []
+ > }
+ > EOF
+ in field "list":
+ while decoding a list:
+ element 0:
+ in field "field":
+ while decoding a list:
+ element 0:
+ in field "type":
+ I tried the following decoders but they all failed:
+ "text" decoder:
+ Expected a string, but got { "content": "user_type_list" }
+ "content" decoder:
+ References in a list can only target a list declared before it, but got
+ { "content": "user_type_list" }
+
+A list cannot reference a list declared after it:
+
+ $ tests --configuration <<EOF
+ > {
+ > "list": [
+ > {
+ > "id": "first_list",
+ > "field": [
+ > {
+ > "name": "other",
+ > "label": {},
+ > "type": { "content": "second_list" }
+ > }
+ > ]
+ > },
+ > { "id": "second_list" }
+ > ],
+ > "content": []
+ > }
+ > EOF
+ in field "list":
+ while decoding a list:
+ element 0:
+ in field "field":
+ while decoding a list:
+ element 0:
+ in field "type":
+ I tried the following decoders but they all failed:
+ "text" decoder:
+ Expected a string, but got { "content": "second_list" }
+ "content" decoder:
+ References in a list can only target a list declared before it, but got
+ { "content": "second_list" }