Commit 644f9729 authored by Jason Choy's avatar Jason Choy

Added a basic name annotation test

parent 87a97a54
......@@ -1651,6 +1651,16 @@ TEST(Encoding, HasEmptyStructList) {
EXPECT_EQ(2, root.totalSize().wordCount);
}
TEST(Encoding, NameAnnotation) {
MallocMessageBuilder message;
auto root = message.initRoot<test::RenamedStruct>();
root.setGoodFieldName(true);
root.setAnotherGoodFieldName(test::RenamedStruct::RenamedEnum::QUX);
EXPECT_EQ(2, static_cast<uint16_t>(test::RenamedStruct::RenamedEnum::QUX));
}
} // namespace
} // namespace _ (private)
} // namespace capnp
......@@ -688,3 +688,18 @@ struct TestProvisionId {}
struct TestRecipientId {}
struct TestThirdPartyCapId {}
struct TestJoinResult {}
struct TestNameAnnotation $Cxx.name("RenamedStruct") {
union {
badFieldName @0 :Bool $Cxx.name("goodFieldName");
bar @1 :Int8;
}
enum BadlyNamedEnum $Cxx.name("RenamedEnum") {
foo @0;
bar @1;
baz @2 $Cxx.name("qux");
}
anotherBadFieldName @2 :BadlyNamedEnum $Cxx.name("anotherGoodFieldName");
}
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