Skip to content

Commit a8c5063

Browse files
authored
Ensure that items emits no annotations for empty arrays (#418)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent b28f3bd commit a8c5063

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

test/evaluator/evaluator_2020_12_test.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,26 @@ TEST(Evaluator_2020_12, items_6_exhaustive) {
542542
"validate against the given subschema");
543543
}
544544

545+
TEST(Evaluator_2020_12, items_7) {
546+
const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({
547+
"$schema": "https://json-schema.org/draft/2020-12/schema",
548+
"items": { "type": "string" }
549+
})JSON")};
550+
551+
const sourcemeta::core::JSON instance{sourcemeta::core::parse_json("[]")};
552+
EVALUATE_WITH_TRACE_FAST_SUCCESS(schema, instance, 0);
553+
}
554+
555+
TEST(Evaluator_2020_12, items_7_exhaustive) {
556+
const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({
557+
"$schema": "https://json-schema.org/draft/2020-12/schema",
558+
"items": { "type": "string" }
559+
})JSON")};
560+
561+
const sourcemeta::core::JSON instance{sourcemeta::core::parse_json("[]")};
562+
EVALUATE_WITH_TRACE_EXHAUSTIVE_SUCCESS(schema, instance, 0);
563+
}
564+
545565
TEST(Evaluator_2020_12, prefixItems_1) {
546566
const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({
547567
"$schema": "https://json-schema.org/draft/2020-12/schema",

0 commit comments

Comments
 (0)