summaryrefslogtreecommitdiff
path: root/tests/test_def.c
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-02-18 18:17:06 -0800
committerJoshua Haberman <joshua@reverberate.org>2011-02-18 18:17:06 -0800
commit61e5d367ff180a4fcd48dd06b9918a9d37edc766 (patch)
treedb9b726919615984bc2bc4750340b90f58777cb2 /tests/test_def.c
parentff23340fe2983b1f034b0e156807b328417d2310 (diff)
Change the API for getting the bootstrapped defs.
The symtab that contains them is now hidden, and you can look them up by name but there is no access to the symtab itself, so there is no risk of mutating it (by extending it, adding other defs to it, etc).
Diffstat (limited to 'tests/test_def.c')
-rw-r--r--tests/test_def.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/test_def.c b/tests/test_def.c
index 2d2658f..287cc32 100644
--- a/tests/test_def.c
+++ b/tests/test_def.c
@@ -5,8 +5,8 @@
int main() {
upb_symtab *s = upb_symtab_new();
- upb_symtab_add_descriptorproto(s);
+ // Will be empty atm since we haven't added anything to the symtab.
int count;
upb_def **defs = upb_symtab_getdefs(s, &count, UPB_DEF_ANY);
for (int i = 0; i < count; i++) {
@@ -14,12 +14,9 @@ int main() {
}
free(defs);
- upb_string *str = upb_strdupc("google.protobuf.FileDescriptorSet");
- upb_def *fds = upb_symtab_lookup(s, str);
+ upb_msgdef *fds = upb_getfdsdef();
assert(fds != NULL);
- assert(upb_dyncast_msgdef(fds) != NULL);
- upb_def_unref(fds);
- upb_string_unref(str);
+ upb_def_unref(UPB_UPCAST(fds));
upb_symtab_unref(s);
return 0;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback