Skip to content

Commit 9676f22

Browse files
committed
json: add test for type: [array, null] fix
1 parent 9c2cc11 commit 9676f22

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test-grammar-integration.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,29 @@ static void test_json_schema() {
773773
}
774774
);
775775

776+
test_schema(
777+
"",
778+
// Schema
779+
R"""(
780+
{
781+
"type": ["array", "null"],
782+
"items": { "type": "string" }
783+
}
784+
)""",
785+
// Passing strings
786+
{
787+
"null",
788+
"[]",
789+
"[\"foo\"]",
790+
"[\"foo\", \"bar\"]",
791+
},
792+
// Failing strings
793+
{
794+
"",
795+
"\"foo\"",
796+
"[\"foo\", 42]",
797+
}
798+
);
776799

777800
test_schema(
778801
"min+max items",

0 commit comments

Comments
 (0)