diff options
Diffstat (limited to 'objectivec/Tests/GPBMessageTests.m')
-rw-r--r-- | objectivec/Tests/GPBMessageTests.m | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/objectivec/Tests/GPBMessageTests.m b/objectivec/Tests/GPBMessageTests.m index cd0de8fc..7b37ca95 100644 --- a/objectivec/Tests/GPBMessageTests.m +++ b/objectivec/Tests/GPBMessageTests.m @@ -55,7 +55,6 @@ [message setOptionalInt32:1]; [message setOptionalString:@"foo"]; [message setOptionalForeignMessage:[ForeignMessage message]]; - message.repeatedStringArray = [NSMutableArray array]; [message.repeatedStringArray addObject:@"bar"]; return message; } @@ -67,7 +66,6 @@ ForeignMessage *foreignMessage = [ForeignMessage message]; [foreignMessage setC:3]; [message setOptionalForeignMessage:foreignMessage]; - message.repeatedStringArray = [NSMutableArray array]; [message.repeatedStringArray addObject:@"qux"]; return message; } @@ -76,7 +74,6 @@ TestAllTypes *message = [TestAllTypes message]; [message setOptionalInt64:2]; [message setOptionalString:@"baz"]; - message.repeatedStringArray = [NSMutableArray array]; [message.repeatedStringArray addObject:@"qux"]; return message; } @@ -89,7 +86,6 @@ ForeignMessage *foreignMessage = [ForeignMessage message]; [foreignMessage setC:3]; [message setOptionalForeignMessage:foreignMessage]; - message.repeatedStringArray = [NSMutableArray array]; [message.repeatedStringArray addObject:@"qux"]; [message.repeatedStringArray addObject:@"bar"]; return message; @@ -102,7 +98,6 @@ [message setOptionalString:@"foo"]; ForeignMessage *foreignMessage = [ForeignMessage message]; [message setOptionalForeignMessage:foreignMessage]; - message.repeatedStringArray = [NSMutableArray array]; [message.repeatedStringArray addObject:@"qux"]; [message.repeatedStringArray addObject:@"bar"]; return message; @@ -195,7 +190,9 @@ // Test merging from data. result = [self mergeExtensionsDestination]; - [result mergeFromData:[[self mergeExtensionsSource] data] + NSData *data = [[self mergeExtensionsSource] data]; + XCTAssertNotNil(data); + [result mergeFromData:data extensionRegistry:[UnittestRoot extensionRegistry]]; resultData = [result data]; XCTAssertEqualObjects(resultData, mergeResultData); @@ -246,7 +243,6 @@ [message setOptionalMessage:self.testRequiredInitialized]; XCTAssertTrue(message.initialized); - message.repeatedMessageArray = [NSMutableArray array]; [message.repeatedMessageArray addObject:[TestRequired message]]; XCTAssertFalse(message.initialized); @@ -298,7 +294,6 @@ - (void)testDataFromNestedUninitialized { TestRequiredForeign *message = [TestRequiredForeign message]; [message setOptionalMessage:[TestRequired message]]; - message.repeatedMessageArray = [NSMutableArray array]; [message.repeatedMessageArray addObject:[TestRequired message]]; [message.repeatedMessageArray addObject:[TestRequired message]]; NSData *data = [message data]; @@ -317,7 +312,6 @@ TestRequiredForeign *message = [TestRequiredForeign message]; [message setOptionalMessage:[TestRequired message]]; - message.repeatedMessageArray = [NSMutableArray array]; [message.repeatedMessageArray addObject:[TestRequired message]]; [message.repeatedMessageArray addObject:[TestRequired message]]; @@ -1884,7 +1878,9 @@ XCTAssertEqual(msg.bar, EnumTestMsg_MyEnum_One); XCTAssertEqual(msg.baz, EnumTestMsg_MyEnum_NegOne); // Bounce to wire and back. - EnumTestMsg *msgPrime = [EnumTestMsg parseFromData:[msg data] error:NULL]; + NSData *data = [msg data]; + XCTAssertNotNil(data); + EnumTestMsg *msgPrime = [EnumTestMsg parseFromData:data error:NULL]; XCTAssertEqualObjects(msgPrime, msg); XCTAssertEqual(msgPrime.foo, EnumTestMsg_MyEnum_Zero); XCTAssertEqual(msgPrime.bar, EnumTestMsg_MyEnum_One); @@ -1896,7 +1892,9 @@ XCTAssertEqual(msg.bar, EnumTestMsg_MyEnum_Two); XCTAssertEqual(msg.baz, EnumTestMsg_MyEnum_NegTwo); // Bounce to wire and back. - msgPrime = [EnumTestMsg parseFromData:[msg data] error:NULL]; + data = [msg data]; + XCTAssertNotNil(data); + msgPrime = [EnumTestMsg parseFromData:data error:NULL]; XCTAssertEqualObjects(msgPrime, msg); XCTAssertEqual(msgPrime.foo, EnumTestMsg_MyEnum_Zero); XCTAssertEqual(msgPrime.bar, EnumTestMsg_MyEnum_Two); @@ -1917,7 +1915,9 @@ XCTAssertEqual([msg.mumbleArray valueAtIndex:3], EnumTestMsg_MyEnum_NegOne); XCTAssertEqual([msg.mumbleArray valueAtIndex:4], EnumTestMsg_MyEnum_NegTwo); // Bounce to wire and back. - msgPrime = [EnumTestMsg parseFromData:[msg data] error:NULL]; + data = [msg data]; + XCTAssertNotNil(data); + msgPrime = [EnumTestMsg parseFromData:data error:NULL]; XCTAssertEqualObjects(msgPrime, msg); XCTAssertEqual([msgPrime.mumbleArray valueAtIndex:0], EnumTestMsg_MyEnum_Zero); |