@@ -118,13 +118,18 @@ TEST(SchemaValidator, Hasher) {
118
118
EXPECT_FALSE (d.HasParseError ());\
119
119
EXPECT_TRUE (expected == d.Accept (validator));\
120
120
EXPECT_TRUE (expected == validator.IsValid ());\
121
+ ValidateErrorCode code = validator.GetInvalidSchemaCode ();\
122
+ if (expected) {\
123
+ EXPECT_TRUE (code == kValidateErrorNone );\
124
+ EXPECT_TRUE (validator.GetInvalidSchemaKeyword () == 0 );\
125
+ }\
121
126
if ((expected) && !validator.IsValid ()) {\
122
127
StringBuffer sb;\
123
128
validator.GetInvalidSchemaPointer ().StringifyUriFragment (sb);\
124
129
printf (" Invalid schema: %s\n " , sb.GetString ());\
125
130
printf (" Invalid keyword: %s\n " , validator.GetInvalidSchemaKeyword ());\
126
- printf (" Invalid code: %d\n " , validator. GetInvalidSchemaCode () );\
127
- printf (" Invalid message: %s\n " , GetValidateError_En (validator. GetInvalidSchemaCode () ));\
131
+ printf (" Invalid code: %d\n " , code );\
132
+ printf (" Invalid message: %s\n " , GetValidateError_En (code ));\
128
133
sb.Clear ();\
129
134
validator.GetInvalidDocumentPointer ().StringifyUriFragment (sb);\
130
135
printf (" Invalid document: %s\n " , sb.GetString ());\
@@ -2522,6 +2527,7 @@ TEST(SchemaValidator, ContinueOnErrors_RogueObject) {
2522
2527
kValidateDefaultFlags | kValidateContinueOnErrorFlag , SchemaValidator, Pointer);
2523
2528
CrtAllocator::Free (schema);
2524
2529
}
2530
+
2525
2531
// Test that when kValidateContinueOnErrorFlag is set, a string appearing for an array or object property is handled
2526
2532
// This tests that we don't blow up when there is a type mismatch.
2527
2533
TEST (SchemaValidator, ContinueOnErrors_RogueString) {
@@ -2544,6 +2550,10 @@ TEST(SchemaValidator, ContinueOnErrors_RogueString) {
2544
2550
CrtAllocator::Free (schema);
2545
2551
}
2546
2552
2553
+ TEST (SchemaValidator, Schema_UnknownError) {
2554
+ ASSERT_TRUE (SchemaValidator::SchemaType::GetValidateErrorKeyword (kValidateErrors ).GetString () == std::string (" null" ));
2555
+ }
2556
+
2547
2557
#if defined(_MSC_VER) || defined(__clang__)
2548
2558
RAPIDJSON_DIAG_POP
2549
2559
#endif
0 commit comments