Commit ff85a173 authored by Thomas Van Lenten's avatar Thomas Van Lenten

More complete nil/reset tests within a oneof

parent a0df678d
......@@ -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];
}
......
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