diff options
author | Josh Haberman <jhaberman@gmail.com> | 2014-07-29 16:12:53 -0700 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2014-07-29 16:12:53 -0700 |
commit | 43f2455cbda22c513f2885d760ca2766b23e100f (patch) | |
tree | 3068031b1f5cc16e530ad25408a3c5a7554a7a28 /tests/test_def.c | |
parent | d493500abc6def6b62d664990ed821e0a836a6cf (diff) |
Added UPB_UNTRACKED_REF and some more handler overload options.
Diffstat (limited to 'tests/test_def.c')
-rw-r--r-- | tests/test_def.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_def.c b/tests/test_def.c index 7efd2b0..92b461f 100644 --- a/tests/test_def.c +++ b/tests/test_def.c @@ -25,6 +25,23 @@ static void test_empty_symtab() { upb_symtab_unref(s, &s); } +static void test_noreftracking() { + // Reftracking is not required; clients can pass UPB_UNTRACKED_REF for owner. + upb_msgdef *md = upb_msgdef_new(UPB_UNTRACKED_REF); + upb_msgdef_ref(md, UPB_UNTRACKED_REF); + + // Clients can mix tracked and untracked refs. + upb_msgdef_ref(md, &md); + + upb_msgdef_unref(md, UPB_UNTRACKED_REF); + upb_msgdef_unref(md, UPB_UNTRACKED_REF); + + // Call some random function on the messagedef to test that it is alive. + ASSERT(!upb_msgdef_isfrozen(md)); + + upb_msgdef_unref(md, &md); +} + static upb_symtab *load_test_proto(void *owner) { upb_symtab *s = upb_symtab_new(owner); ASSERT(s); @@ -271,5 +288,6 @@ int run_tests(int argc, char *argv[]) { test_replacement(); test_freeze_free(); test_partial_freeze(); + test_noreftracking(); return 0; } |