diff options
author | Jay Berkenbilt <ejb@ql.org> | 2020-04-04 23:31:07 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2020-04-05 00:06:32 +0200 |
commit | 72464041771de52ca6b3f8bc79aea84c23af30b6 (patch) | |
tree | 8d8a309a0be0e1563542e4d16d02564440d3837a /libtests/json.cc | |
parent | 67d5ed3a64a81f9192c17dc71f02e69f60f8a1f8 (diff) | |
download | qpdf-72464041771de52ca6b3f8bc79aea84c23af30b6.tar.zst |
JSON: implement pattern keys in schema
Diffstat (limited to 'libtests/json.cc')
-rw-r--r-- | libtests/json.cc | 11 |
1 files changed, 10 insertions, 1 deletions
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( + "<objid>", + 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"); |