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

Unified Diff: tools/json_schema_compiler/test/objects_unittest.cc

Issue 1829753003: [Extensions] Update generated code to support movable additional properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Antony's Created 4 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
« no previous file with comments | « tools/json_schema_compiler/test/objects_movable_json.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/test/objects_unittest.cc
diff --git a/tools/json_schema_compiler/test/objects_unittest.cc b/tools/json_schema_compiler/test/objects_unittest.cc
index 2cb6fc62c4a7016575371965d83e180633a8073f..cd08793532364e7ef42132c6d1902b9872d01c6c 100644
--- a/tools/json_schema_compiler/test/objects_unittest.cc
+++ b/tools/json_schema_compiler/test/objects_unittest.cc
@@ -8,9 +8,11 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "tools/json_schema_compiler/test/objects.h"
#include "tools/json_schema_compiler/test/objects_movable.h"
+#include "tools/json_schema_compiler/test/objects_movable_json.h"
using namespace test::api::objects;
using namespace test::api::objects_movable;
+using namespace test::api::objects_movable_json;
TEST(JsonSchemaCompilerObjectsTest, ObjectParamParamsCreate) {
{
@@ -93,6 +95,7 @@ TEST(JsonSchemaCompilerMovableObjectsTest, MovableObjectsTest) {
MovableParent parent;
parent.pods = std::move(pods);
parent.strs.push_back("pstr");
+ parent.blob.additional_properties.SetString("key", "val");
MovableParent parent2(std::move(parent));
ASSERT_EQ(2u, parent2.pods.size());
@@ -106,4 +109,25 @@ TEST(JsonSchemaCompilerMovableObjectsTest, MovableObjectsTest) {
EXPECT_FALSE(parent2.pods[1].b);
ASSERT_EQ(1u, parent2.strs.size());
EXPECT_EQ("pstr", parent2.strs[0]);
+ std::string blob_string;
+ EXPECT_TRUE(
+ parent2.blob.additional_properties.GetString("key", &blob_string));
+ EXPECT_EQ("val", blob_string);
+
+ MovableWithAdditional with_additional;
+ with_additional.str = "str";
+ std::vector<std::string> vals1;
+ vals1.push_back("vals1a");
+ vals1.push_back("vals1b");
+ with_additional.additional_properties["key1"] = vals1;
+ std::vector<std::string> vals2;
+ vals2.push_back("vals2a");
+ vals2.push_back("vals2b");
+ with_additional.additional_properties["key2"] = vals2;
+
+ MovableWithAdditional with_additional2(std::move(with_additional));
+ EXPECT_EQ("str", with_additional2.str);
+ EXPECT_EQ(2u, with_additional2.additional_properties.size());
+ EXPECT_EQ(vals1, with_additional2.additional_properties["key1"]);
+ EXPECT_EQ(vals2, with_additional2.additional_properties["key2"]);
}
« no previous file with comments | « tools/json_schema_compiler/test/objects_movable_json.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698