aboutsummaryrefslogtreecommitdiffstats
path: root/libtests
diff options
context:
space:
mode:
Diffstat (limited to 'libtests')
-rw-r--r--libtests/json.cc11
-rw-r--r--libtests/qtest/json/json.out4
2 files changed, 13 insertions, 2 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");
diff --git a/libtests/qtest/json/json.out b/libtests/qtest/json/json.out
index f06cc1fb..ad668e51 100644
--- a/libtests/qtest/json/json.out
+++ b/libtests/qtest/json/json.out
@@ -1,11 +1,13 @@
--- top-level type mismatch
top-level object is supposed to be a dictionary
---
---- top-level type mismatch
+--- missing items
json key "./one./a": key "/q" is present in schema but missing in object
json key "./one./a./r" is supposed to be a dictionary
json key "./one./a./s" is supposed to be an array
json key "./one./a": key "/t" is not present in schema but appears in object
+json key "./three./anything": key "/z" is present in schema but missing in object
+json key "./three./anything": key "/x" is not present in schema but appears in object
json key "./two.1": key "/glarp" is present in schema but missing in object
json key "./two.1": key "/flarp" is not present in schema but appears in object
json key "./two.2" is supposed to be a dictionary