Use correct enum values.

The clang Xcode 12.5 seems to actually detect this long standing mistake.
pull/8597/head^2
Thomas Van Lenten 4 years ago
parent b0d90e3abe
commit 23fd8e0791
  1. 2
      objectivec/Tests/GPBMessageTests+Runtime.m
  2. 6
      objectivec/Tests/GPBMessageTests+Serialization.m

@ -2446,7 +2446,7 @@
msg.oneofBytes = oneofBytesDefault; msg.oneofBytes = oneofBytesDefault;
break; break;
case Message2_O_OneOfCase_OneofEnum: case Message2_O_OneOfCase_OneofEnum:
msg.oneofEnum = Message3_Enum_Baz; msg.oneofEnum = Message2_Enum_Baz;
break; break;
default: default:
XCTFail(@"shouldn't happen, loop: %zd, value: %d", i, values[i]); XCTFail(@"shouldn't happen, loop: %zd, value: %d", i, values[i]);

@ -559,7 +559,7 @@
//%TEST_ROUNDTRIP_ONEOF_ADV(Message##SYNTAX, String, @"foo", Objects) //%TEST_ROUNDTRIP_ONEOF_ADV(Message##SYNTAX, String, @"foo", Objects)
//%TEST_ROUNDTRIP_ONEOF_ADV(Message##SYNTAX, Bytes, [@"bar" dataUsingEncoding:NSUTF8StringEncoding], Objects) //%TEST_ROUNDTRIP_ONEOF_ADV(Message##SYNTAX, Bytes, [@"bar" dataUsingEncoding:NSUTF8StringEncoding], Objects)
//%GROUP_TEST##SYNTAX()TEST_ROUNDTRIP_ONEOF_ADV(Message##SYNTAX, Message, subMessage, Objects) //%GROUP_TEST##SYNTAX()TEST_ROUNDTRIP_ONEOF_ADV(Message##SYNTAX, Message, subMessage, Objects)
//%TEST_ROUNDTRIP_ONEOF(Message##SYNTAX, Enum, Message2_Enum_Bar) //%TEST_ROUNDTRIP_ONEOF(Message##SYNTAX, Enum, Message##SYNTAX##_Enum_Bar)
//%GROUP_CLEANUP##SYNTAX() [subMessage release]; //%GROUP_CLEANUP##SYNTAX() [subMessage release];
//%} //%}
//% //%
@ -1022,13 +1022,13 @@
{ // oneofEnum { // oneofEnum
Message3 *orig = [[Message3 alloc] init]; Message3 *orig = [[Message3 alloc] init];
orig.oneofEnum = Message2_Enum_Bar; orig.oneofEnum = Message3_Enum_Bar;
XCTAssertEqual(orig.oOneOfCase, Message3_O_OneOfCase_OneofEnum); XCTAssertEqual(orig.oOneOfCase, Message3_O_OneOfCase_OneofEnum);
NSData *data = [orig data]; NSData *data = [orig data];
XCTAssertNotNil(data); XCTAssertNotNil(data);
Message3 *msg = [Message3 parseFromData:data error:NULL]; Message3 *msg = [Message3 parseFromData:data error:NULL];
XCTAssertEqual(msg.oOneOfCase, Message3_O_OneOfCase_OneofEnum); XCTAssertEqual(msg.oOneOfCase, Message3_O_OneOfCase_OneofEnum);
XCTAssertEqual(msg.oneofEnum, Message2_Enum_Bar); XCTAssertEqual(msg.oneofEnum, Message3_Enum_Bar);
[orig release]; [orig release];
} }

Loading…
Cancel
Save