More complete nil/reset tests within a oneof
This commit is contained in:
parent
a0df678df9
commit
ff85a1735f
1 changed files with 12 additions and 6 deletions
|
@ -2178,7 +2178,7 @@
|
|||
// Should be set to the correct case.
|
||||
XCTAssertEqual(msg.oOneOfCase, values[i], "Loop: %zd", i);
|
||||
|
||||
// Confirm everything is back as the defaults.
|
||||
// Confirm everything is the defaults.
|
||||
XCTAssertEqual(msg.oneofInt32, 100, "Loop: %zd", i);
|
||||
XCTAssertEqual(msg.oneofInt64, 101, "Loop: %zd", i);
|
||||
XCTAssertEqual(msg.oneofUint32, 102U, "Loop: %zd", i);
|
||||
|
@ -2194,22 +2194,25 @@
|
|||
XCTAssertEqual(msg.oneofBool, YES, "Loop: %zd", i);
|
||||
XCTAssertEqualObjects(msg.oneofString, oneofStringDefault, "Loop: %zd", i);
|
||||
XCTAssertEqualObjects(msg.oneofBytes, oneofBytesDefault, "Loop: %zd", i);
|
||||
XCTAssertNotNil(msg.oneofGroup, "Loop: %zd", i);
|
||||
// Skip group
|
||||
// Skip message
|
||||
// Skip group, no default to consider.
|
||||
// Skip message, no default to consider.
|
||||
XCTAssertEqual(msg.oneofEnum, Message2_Enum_Baz, "Loop: %zd", i);
|
||||
}
|
||||
|
||||
// We special case nil on string, data, group, message, ensure they work as
|
||||
// expected. i.e. - it clears the case.
|
||||
// We special case nil on string, data, group, and message, ensure they work
|
||||
// as expected. i.e. - it clears the case.
|
||||
msg.oneofString = nil;
|
||||
XCTAssertEqualObjects(msg.oneofString, oneofStringDefault);
|
||||
XCTAssertEqual(msg.oOneOfCase, Message2_O_OneOfCase_GPBUnsetOneOfCase);
|
||||
msg.oneofBytes = nil;
|
||||
XCTAssertEqual(msg.oOneOfCase, Message2_O_OneOfCase_GPBUnsetOneOfCase);
|
||||
XCTAssertEqualObjects(msg.oneofBytes, oneofBytesDefault);
|
||||
msg.oneofGroup = nil;
|
||||
XCTAssertEqual(msg.oOneOfCase, Message2_O_OneOfCase_GPBUnsetOneOfCase);
|
||||
XCTAssertNotNil(msg.oneofGroup);
|
||||
msg.oneofMessage = nil;
|
||||
XCTAssertEqual(msg.oOneOfCase, Message2_O_OneOfCase_GPBUnsetOneOfCase);
|
||||
XCTAssertNotNil(msg.oneofMessage);
|
||||
|
||||
[msg release];
|
||||
}
|
||||
|
@ -2329,10 +2332,13 @@
|
|||
// We special case nil on string, data, message, ensure they work as expected.
|
||||
msg.oneofString = nil;
|
||||
XCTAssertEqual(msg.oOneOfCase, Message3_O_OneOfCase_GPBUnsetOneOfCase);
|
||||
XCTAssertEqualObjects(msg.oneofString, oneofStringDefault);
|
||||
msg.oneofBytes = nil;
|
||||
XCTAssertEqual(msg.oOneOfCase, Message3_O_OneOfCase_GPBUnsetOneOfCase);
|
||||
XCTAssertEqualObjects(msg.oneofBytes, oneofBytesDefault);
|
||||
msg.oneofMessage = nil;
|
||||
XCTAssertEqual(msg.oOneOfCase, Message3_O_OneOfCase_GPBUnsetOneOfCase);
|
||||
XCTAssertNotNil(msg.oneofMessage);
|
||||
|
||||
[msg release];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue