Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1496)

Side by Side Diff: components/json_schema/json_schema_validator_unittest.cc

Issue 195193002: Add regular expression support in json_schema component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/values.h" 5 #include "base/values.h"
6 #include "components/json_schema/json_schema_validator.h" 6 #include "components/json_schema/json_schema_validator.h"
7 #include "components/json_schema/json_schema_validator_unittest_base.h" 7 #include "components/json_schema/json_schema_validator_unittest_base.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 class JSONSchemaValidatorCPPTest : public JSONSchemaValidatorTestBase { 10 class JSONSchemaValidatorCPPTest : public JSONSchemaValidatorTestBase {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 " ]" 127 " ]"
128 " }" 128 " }"
129 " }," 129 " },"
130 " \"additionalProperties\": {" 130 " \"additionalProperties\": {"
131 " \"type\": \"any\"" 131 " \"type\": \"any\""
132 " }" 132 " }"
133 "}", &error)) << error; 133 "}", &error)) << error;
134 EXPECT_TRUE(JSONSchemaValidator::IsValidSchema( 134 EXPECT_TRUE(JSONSchemaValidator::IsValidSchema(
135 "{" 135 "{"
136 " \"type\": \"object\"," 136 " \"type\": \"object\","
137 " \"patternProperties\": {"
138 " \".\": { \"type\": \"any\" },"
139 " \"foo\": { \"type\": \"any\" },"
140 " \"^foo$\": { \"type\": \"any\" },"
141 " \"foo+\": { \"type\": \"any\" },"
142 " \"foo?\": { \"type\": \"any\" },"
143 " \"fo{2,4}\": { \"type\": \"any\" },"
144 " \"(left)|(right)\": { \"type\": \"any\" }"
145 " }"
146 "}", &error)) << error;
147 EXPECT_TRUE(JSONSchemaValidator::IsValidSchema(
148 "{"
149 " \"type\": \"object\","
137 " \"unknown attribute\": \"that should just be ignored\"" 150 " \"unknown attribute\": \"that should just be ignored\""
138 "}", 151 "}",
139 JSONSchemaValidator::OPTIONS_IGNORE_UNKNOWN_ATTRIBUTES, 152 JSONSchemaValidator::OPTIONS_IGNORE_UNKNOWN_ATTRIBUTES,
140 &error)) << error; 153 &error)) << error;
141 EXPECT_FALSE(JSONSchemaValidator::IsValidSchema( 154 EXPECT_FALSE(JSONSchemaValidator::IsValidSchema(
142 "{" 155 "{"
143 " \"type\": \"object\"," 156 " \"type\": \"object\","
144 " \"unknown attribute\": \"that will cause a failure\"" 157 " \"unknown attribute\": \"that will cause a failure\""
145 "}", 0, &error)) << error; 158 "}", 0, &error)) << error;
146 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698