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

Unified Diff: third_party/protobuf/objectivec/Tests/GPBUtilitiesTests.m

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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: third_party/protobuf/objectivec/Tests/GPBUtilitiesTests.m
diff --git a/third_party/protobuf/objectivec/Tests/GPBUtilitiesTests.m b/third_party/protobuf/objectivec/Tests/GPBUtilitiesTests.m
index ba1fc270e6ffdec240976b454c1963454c0e7d8a..dfaca660e30efe282554f76fed0a9a2c1c95c0af 100644
--- a/third_party/protobuf/objectivec/Tests/GPBUtilitiesTests.m
+++ b/third_party/protobuf/objectivec/Tests/GPBUtilitiesTests.m
@@ -170,4 +170,31 @@
// TODO(thomasvl): add test with extensions once those format with correct names.
+- (void)testSetRepeatedFields {
+ TestAllTypes *message = [TestAllTypes message];
+
+ NSDictionary *repeatedFieldValues = @{
+ @"repeatedStringArray" : [@[@"foo", @"bar"] mutableCopy],
+ @"repeatedBoolArray" : [GPBBoolArray arrayWithValue:YES],
+ @"repeatedInt32Array" : [GPBInt32Array arrayWithValue:14],
+ @"repeatedInt64Array" : [GPBInt64Array arrayWithValue:15],
+ @"repeatedUint32Array" : [GPBUInt32Array arrayWithValue:16],
+ @"repeatedUint64Array" : [GPBUInt64Array arrayWithValue:16],
+ @"repeatedFloatArray" : [GPBFloatArray arrayWithValue:16],
+ @"repeatedDoubleArray" : [GPBDoubleArray arrayWithValue:16],
+ @"repeatedNestedEnumArray" :
+ [GPBEnumArray arrayWithValidationFunction:TestAllTypes_NestedEnum_IsValidValue
+ rawValue:TestAllTypes_NestedEnum_Foo],
+ };
+ for (NSString *fieldName in repeatedFieldValues) {
+ GPBFieldDescriptor *field =
+ [message.descriptor fieldWithName:fieldName];
+ XCTAssertNotNil(field, @"No field with name: %@", fieldName);
+ id expectedValues = repeatedFieldValues[fieldName];
+ GPBSetMessageRepeatedField(message, field, expectedValues);
+ XCTAssertEqualObjects(expectedValues,
+ [message valueForKeyPath:fieldName]);
+ }
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698