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

Unified 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: fix comment 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 side-by-side diff with in-line comments
Download patch
Index: components/json_schema/json_schema_validator_unittest.cc
diff --git a/components/json_schema/json_schema_validator_unittest.cc b/components/json_schema/json_schema_validator_unittest.cc
index 73809de5c860fd2b52a5b23a862fcc7e36994cfe..aaa255568505073b90b5b1b2a08f29ff263c3c01 100644
--- a/components/json_schema/json_schema_validator_unittest.cc
+++ b/components/json_schema/json_schema_validator_unittest.cc
@@ -9,9 +9,7 @@
class JSONSchemaValidatorCPPTest : public JSONSchemaValidatorTestBase {
public:
- JSONSchemaValidatorCPPTest()
- : JSONSchemaValidatorTestBase(JSONSchemaValidatorTestBase::CPP) {
- }
+ JSONSchemaValidatorCPPTest() : JSONSchemaValidatorTestBase() {}
protected:
virtual void ExpectValid(const std::string& test_source,
@@ -134,6 +132,19 @@ TEST(JSONSchemaValidator, IsValidSchema) {
EXPECT_TRUE(JSONSchemaValidator::IsValidSchema(
"{"
" \"type\": \"object\","
+ " \"patternProperties\": {"
+ " \".\": { \"type\": \"any\" },"
+ " \"foo\": { \"type\": \"any\" },"
+ " \"^foo$\": { \"type\": \"any\" },"
+ " \"foo+\": { \"type\": \"any\" },"
+ " \"foo?\": { \"type\": \"any\" },"
+ " \"fo{2,4}\": { \"type\": \"any\" },"
+ " \"(left)|(right)\": { \"type\": \"any\" }"
+ " }"
+ "}", &error)) << error;
+ EXPECT_TRUE(JSONSchemaValidator::IsValidSchema(
+ "{"
+ " \"type\": \"object\","
" \"unknown attribute\": \"that should just be ignored\""
"}",
JSONSchemaValidator::OPTIONS_IGNORE_UNKNOWN_ATTRIBUTES,
« no previous file with comments | « components/json_schema/json_schema_validator.cc ('k') | components/json_schema/json_schema_validator_unittest_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698