@@ -124,14 +124,20 @@ TEST(SchemaValidator, Hasher) {
124
124
125
125
#define INVALIDATE (schema, json, invalidSchemaPointer, invalidSchemaKeyword, invalidDocumentPointer ) \
126
126
{\
127
- SchemaValidator validator (schema);\
127
+ INVALIDATE_ (schema, json, invalidSchemaPointer, invalidSchemaKeyword, invalidDocumentPointer, SchemaValidator, Pointer) \
128
+ }
129
+
130
+ #define INVALIDATE_ (schema, json, invalidSchemaPointer, invalidSchemaKeyword, invalidDocumentPointer,\
131
+ SchemaValidatorType, PointerType) \
132
+ {\
133
+ SchemaValidatorType validator (schema);\
128
134
Document d;\
129
135
/* printf("\n%s\n", json);*/ \
130
136
d.Parse (json);\
131
137
EXPECT_FALSE (d.HasParseError ());\
132
138
EXPECT_FALSE (d.Accept (validator));\
133
139
EXPECT_FALSE (validator.IsValid ());\
134
- if (validator.GetInvalidSchemaPointer () != Pointer (invalidSchemaPointer)) {\
140
+ if (validator.GetInvalidSchemaPointer () != PointerType (invalidSchemaPointer)) {\
135
141
StringBuffer sb;\
136
142
validator.GetInvalidSchemaPointer ().Stringify (sb);\
137
143
printf (" GetInvalidSchemaPointer() Expected: %s Actual: %s\n " , invalidSchemaPointer, sb.GetString ());\
@@ -142,7 +148,7 @@ TEST(SchemaValidator, Hasher) {
142
148
printf (" GetInvalidSchemaKeyword() Expected: %s Actual %s\n " , invalidSchemaKeyword, validator.GetInvalidSchemaKeyword ());\
143
149
ADD_FAILURE ();\
144
150
}\
145
- if (validator.GetInvalidDocumentPointer () != Pointer (invalidDocumentPointer)) {\
151
+ if (validator.GetInvalidDocumentPointer () != PointerType (invalidDocumentPointer)) {\
146
152
StringBuffer sb;\
147
153
validator.GetInvalidDocumentPointer ().Stringify (sb);\
148
154
printf (" GetInvalidDocumentPointer() Expected: %s Actual: %s\n " , invalidDocumentPointer, sb.GetString ());\
@@ -1348,6 +1354,17 @@ TEST(SchemaValidator, Issue1017_allOfHandler) {
1348
1354
EXPECT_STREQ (" {\" cyanArray2\" :[],\" blackArray\" :[]}" , sb.GetString ());
1349
1355
}
1350
1356
1357
+ TEST (SchemaValidator, Ref_remote) {
1358
+ typedef GenericSchemaDocument<Value, MemoryPoolAllocator<> > SchemaDocumentType;
1359
+ RemoteSchemaDocumentProvider<SchemaDocumentType> provider;
1360
+ Document sd;
1361
+ sd.Parse (" {\" $ref\" : \" http://localhost:1234/subSchemas.json#/integer\" }" );
1362
+ SchemaDocumentType s (sd, &provider);
1363
+ typedef GenericSchemaValidator<SchemaDocumentType, BaseReaderHandler<UTF8<> >, MemoryPoolAllocator<> > SchemaValidatorType;
1364
+ typedef GenericPointer<Value, MemoryPoolAllocator<> > PointerType;
1365
+ INVALIDATE_ (s, " null" , " /integer" , " type" , " " , SchemaValidatorType, PointerType);
1366
+ }
1367
+
1351
1368
#ifdef __clang__
1352
1369
RAPIDJSON_DIAG_POP
1353
1370
#endif
0 commit comments