Commit 1383d53e authored by Thomas Van Lenten's avatar Thomas Van Lenten

Cleanups for newer Xcodes

- Move up to 8.4 as the high simulator (assuming Xcode 6.4).
- Add cast to NSMutableDictionary so clang and resolve the selector.
- Add case for the newer static analyzer so it won't trigger a false warning.
- Update the "dictionary" interface to use "object" naming. Xcode 7+ has gotten
  more strict on the use of nonnull/nullable; combining that with the generic
  collection support; and the "dictionary" classes we created now collide with
  what the generic KeyValueCoding in the system headers triggering
  warnings/errors. Fix this and hopefully all future issue by renaming the
  methods to use "object" for the classes that have data types as objects
  instead of PODs. Taking this renaming hit now while ObjC is still in beta
  because it is a breaking change for any existing code.
parent 0e5686a7
......@@ -202,9 +202,9 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
# Don't need to worry about form factors or retina/non retina;
# just pick a mix of OS Versions and 32/64 bit.
-destination "platform=iOS Simulator,name=iPhone 4s,OS=7.1" # 32bit
-destination "platform=iOS Simulator,name=iPhone 6,OS=8.3" # 64bit
-destination "platform=iOS Simulator,name=iPhone 6,OS=8.4" # 64bit
-destination "platform=iOS Simulator,name=iPad 2,OS=7.1" # 32bit
-destination "platform=iOS Simulator,name=iPad Air,OS=8.3" # 64bit
-destination "platform=iOS Simulator,name=iPad Air,OS=8.4" # 64bit
)
header "Doing Xcode iOS build/tests - Debug"
"${XCODEBUILD_TEST_BASE_IOS[@]}" -configuration Debug test
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -211,10 +211,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
// 2 is save keys, different values; not equal.
// 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
// 3 is different keys, samae values; not equal.
// 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
......@@ -568,10 +568,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
// 2 is save keys, different values; not equal.
// 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
// 3 is different keys, samae values; not equal.
// 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
......@@ -925,10 +925,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
// 2 is save keys, different values; not equal.
// 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
// 3 is different keys, samae values; not equal.
// 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
......@@ -1282,10 +1282,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
// 2 is save keys, different values; not equal.
// 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
// 3 is different keys, samae values; not equal.
// 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
......@@ -1639,10 +1639,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
// 2 is save keys, different values; not equal.
// 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
// 3 is different keys, samae values; not equal.
// 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
......@@ -1996,10 +1996,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
// 2 is save keys, different values; not equal.
// 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
// 3 is different keys, samae values; not equal.
// 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
......@@ -2353,10 +2353,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
// 2 is save keys, different values; not equal.
// 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
// 3 is different keys, samae values; not equal.
// 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
......@@ -2710,10 +2710,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
// 2 is save keys, different values; not equal.
// 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
// 3 is different keys, samae values; not equal.
// 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
......@@ -3071,10 +3071,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
// 2 is save keys, different values; not equal.
// 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
// 3 is different keys, samae values; not equal.
// 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
......
This diff is collapsed.
......@@ -676,20 +676,21 @@
TestAllTypes *subMsg = [TestAllTypes message];
subMsg.repeatedInt32Array = [GPBInt32Array arrayWithValue:100];
msg1.mapInt32Message = [GPBInt32ObjectDictionary dictionary];
[msg1.mapInt32Message setValue:subMsg forKey:0];
[msg1.mapInt32Message setObject:subMsg forKey:0];
subMsg = nil;
subMsg = [TestAllTypes message];
subMsg.repeatedInt32Array = [GPBInt32Array arrayWithValue:101];
msg2.mapInt32Message = [GPBInt32ObjectDictionary dictionary];
[msg2.mapInt32Message setValue:subMsg forKey:0];
[msg2.mapInt32Message setObject:subMsg forKey:0];
subMsg = nil;
[msg1 mergeFrom:msg2];
// Checks repeated field is overwritten.
XCTAssertEqual(msg1.mapInt32Message.count, 1U);
subMsg = [msg1.mapInt32Message valueForKey:0];
subMsg = [msg1.mapInt32Message objectForKey:0];
XCTAssertNotNil(subMsg);
XCTAssertEqual(subMsg.repeatedInt32Array.count, 1U);
XCTAssertEqual([subMsg.repeatedInt32Array valueAtIndex:0], 101);
......
......@@ -2059,9 +2059,9 @@
// Ensure the messages are unique per map.
[msg1.mapInt32ForeignMessage
enumerateKeysAndValuesUsingBlock:^(int32_t key, id value, BOOL *stop) {
enumerateKeysAndObjectsUsingBlock:^(int32_t key, id value, BOOL *stop) {
#pragma unused(stop)
ForeignMessage *subMsg2 = [msg2.mapInt32ForeignMessage valueForKey:key];
ForeignMessage *subMsg2 = [msg2.mapInt32ForeignMessage objectForKey:key];
XCTAssertNotEqual(value, subMsg2); // Ptr compare, new object.
}];
}
......@@ -2075,7 +2075,7 @@
// Add an uninitialized message.
TestRequired *subMsg = [[TestRequired alloc] init];
msg.mapField = [GPBInt32ObjectDictionary dictionary];
[msg.mapField setValue:subMsg forKey:0];
[msg.mapField setObject:subMsg forKey:0];
XCTAssertFalse(msg.initialized);
// Initialize uninitialized message
......
......@@ -994,16 +994,16 @@ static NSData *DataFromCStr(const char *str) {
val2.optionalInt32 = 129;
[msg.mapStringMessage setValue:val1 forKey:@"228"];
[msg.mapStringMessage setValue:val2 forKey:@"2029"];
[msg.mapInt32Bytes setValue:DataFromCStr("1030 bytes") forKey:230];
[msg.mapInt32Bytes setValue:DataFromCStr("131") forKey:2031];
[msg.mapInt32Bytes setObject:DataFromCStr("1030 bytes") forKey:230];
[msg.mapInt32Bytes setObject:DataFromCStr("131") forKey:2031];
[msg.mapInt32Enum setValue:Message2_Enum_Bar forKey:232];
[msg.mapInt32Enum setValue:Message2_Enum_Baz forKey:2033];
Message2 *val3 = [[Message2 alloc] init];
val3.optionalInt32 = 1034;
Message2 *val4 = [[Message2 alloc] init];
val4.optionalInt32 = 135;
[msg.mapInt32Message setValue:val3 forKey:234];
[msg.mapInt32Message setValue:val4 forKey:2035];
[msg.mapInt32Message setObject:val3 forKey:234];
[msg.mapInt32Message setObject:val4 forKey:2035];
NSData *data = [msg data];
Message2 *msg2 = [[Message2 alloc] initWithData:data error:NULL];
......
......@@ -1110,7 +1110,7 @@ const uint32_t kGPBDefaultRepeatCount = 2;
[dataStr release];
NSData *data = [[NSData alloc] initWithUint32_gpbtu:i + 1];
[message.mapInt32Bytes setValue:data forKey:113 + i * 100];
[message.mapInt32Bytes setObject:data forKey:113 + i * 100];
[data release];
[message.mapInt32Enum
......@@ -1119,7 +1119,7 @@ const uint32_t kGPBDefaultRepeatCount = 2;
ForeignMessage *subMsg = [[ForeignMessage alloc] init];
subMsg.c = i + 1;
[message.mapInt32ForeignMessage setValue:subMsg forKey:115 + i * 100];
[message.mapInt32ForeignMessage setObject:subMsg forKey:115 + i * 100];
[subMsg release];
}
}
......
......@@ -167,12 +167,12 @@ const int kUnknownTypeId = 1550055;
XCTAssertEqual([raw.itemArray[2] typeId], kUnknownTypeId);
TestMessageSetExtension1* message1 =
[TestMessageSetExtension1 parseFromData:[raw.itemArray[0] message]
[TestMessageSetExtension1 parseFromData:[((RawMessageSet_Item*)raw.itemArray[0]) message]
error:NULL];
XCTAssertEqual(message1.i, 123);
TestMessageSetExtension2* message2 =
[TestMessageSetExtension2 parseFromData:[raw.itemArray[1] message]
[TestMessageSetExtension2 parseFromData:[((RawMessageSet_Item*)raw.itemArray[1]) message]
error:NULL];
XCTAssertEqualObjects(message2.str, @"foo");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment