summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexei Rousskikh <ext-alexei.rousskikh@nokia.com>2012-03-05 10:46:52 -0500
committerChris Craig <ext-chris.craig@nokia.com>2012-03-05 21:46:26 +0100
commitc84ef3980f2d0f7e214c002f03db4be3e03f73b8 (patch)
tree99151de305d4052a28001a2d200f0bb80b887da6 /tests
parent5c55284cceea22fcd4768f4b41fcfb7e0f893d0c (diff)
implemented self reference ({"$ref" : "#"}) (required for a self validation)
Change-Id: I0ebb0c3c1a26e7f734ccd9784cfbe11fcc5b5e30 Reviewed-by: Chris Craig <ext-chris.craig@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/jsonschema/tst_jsonschema.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/jsonschema/tst_jsonschema.cpp b/tests/auto/jsonschema/tst_jsonschema.cpp
index 379d928..82d1109 100644
--- a/tests/auto/jsonschema/tst_jsonschema.cpp
+++ b/tests/auto/jsonschema/tst_jsonschema.cpp
@@ -496,6 +496,10 @@ void tst_JsonSchema::testExtendsValidation()
// 5.28
void tst_JsonSchema::testRefValidation()
{
+ //
+ QVERIFY(validate("{ \"a\" : {} }", "{ \"type\" : \"object\", \"additionalProperties\" : { \"$ref\" : \"#\" } }"));
+ QVERIFY(!validate("{ \"a\" : 1 }", "{ \"type\" : \"object\", \"additionalProperties\" : { \"$ref\" : \"#\" } }"));
+ QVERIFY(!validate("{ \"a\" : \"1\" }", "{ \"type\" : \"object\", \"additionalProperties\" : { \"$ref\" : \"#\" } }"));
}
bool tst_JsonSchema::validate(const char *data, const QByteArray & schemaBody)