From 3bd667e95f8f00e4c62b670374dd852995c870c4 Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Mon, 15 Dec 2014 13:42:24 -0800 Subject: Added msgdef flag to indicate map_entry protos. --- tests/test_def.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/test_def.c b/tests/test_def.c index 84082df..dcf80c0 100644 --- a/tests/test_def.c +++ b/tests/test_def.c @@ -328,6 +328,20 @@ static void test_partial_freeze() { upb_msgdef_unref(m3, &m3); } +static void test_descriptor_flags() { + upb_msgdef *m = upb_msgdef_new(&m); + ASSERT(upb_msgdef_mapentry(m) == false); + upb_status s = UPB_STATUS_INIT; + upb_msgdef_setfullname(m, "TestMessage", &s); + ASSERT(upb_ok(&s)); + upb_msgdef_setmapentry(m, true); + ASSERT(upb_msgdef_mapentry(m) == true); + upb_msgdef *m2 = upb_msgdef_dup(m, &m2); + ASSERT(upb_msgdef_mapentry(m2) == true); + upb_msgdef_unref(m, &m); + upb_msgdef_unref(m2, &m2); +} + int run_tests(int argc, char *argv[]) { if (argc < 2) { fprintf(stderr, "Usage: test_def \n"); @@ -343,5 +357,6 @@ int run_tests(int argc, char *argv[]) { test_freeze_free(); test_partial_freeze(); test_noreftracking(); + test_descriptor_flags(); return 0; } -- cgit v1.2.3