Commit ceb38966 authored by Kenton Varda's avatar Kenton Varda

Add a test for adopting a null pointer just to be safe.

parent 4d4f831a
......@@ -71,6 +71,17 @@ TEST(Orphans, EmptyStructOverwrite) {
EXPECT_FALSE(anyPointer.isNull());
}
TEST(Orphans, AdoptNullStruct) {
MallocMessageBuilder builder;
auto root = builder.initRoot<test::TestAnyPointer>();
auto anyPointer = root.getAnyPointerField();
EXPECT_TRUE(anyPointer.isNull());
anyPointer.initAs<TestAllTypes>();
anyPointer.adopt(Orphan<test::TestEmptyStruct>());
EXPECT_EQ(0, anyPointer.targetSize().wordCount);
EXPECT_TRUE(anyPointer.isNull());
}
TEST(Orphans, Lists) {
MallocMessageBuilder builder;
auto root = builder.initRoot<TestAllTypes>();
......
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