From 72464041771de52ca6b3f8bc79aea84c23af30b6 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 4 Apr 2020 17:31:07 -0400 Subject: JSON: implement pattern keys in schema --- libtests/json.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libtests/json.cc') diff --git a/libtests/json.cc b/libtests/json.cc index e3086c18..1ee7a5d3 100644 --- a/libtests/json.cc +++ b/libtests/json.cc @@ -112,6 +112,11 @@ static void test_schema() " >>" " ]" ">>").getJSON(); + JSON three = JSON::makeDictionary(); + three.addDictionaryMember( + "", + QPDFObjectHandle::parse("<< /z (ebra) >>").getJSON()); + schema.addDictionaryMember("/three", three); JSON a = QPDFObjectHandle::parse("[(not a) (dictionary)]").getJSON(); check_schema(a, schema, false, "top-level type mismatch"); JSON b = QPDFObjectHandle::parse( @@ -142,8 +147,12 @@ static void test_schema() " /glarp (4 enspliel)" " >>" " ]" + " /three <<" + " /anything << /x (oops) >>" + " /else << /z (okay) >>" + " >>" ">>").getJSON(); - check_schema(b, schema, false, "top-level type mismatch"); + check_schema(b, schema, false, "missing items"); check_schema(a, a, false, "top-level schema array error"); check_schema(b, b, false, "lower-level schema array error"); check_schema(schema, schema, true, "pass"); -- cgit v1.2.3-70-g09d2