summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2010-07-10 20:13:06 -0700
committerJoshua Haberman <joshua@reverberate.org>2010-07-10 20:13:06 -0700
commitc7a95061a7c02ffeebd71eeb56bf19fc1c1797dd (patch)
treed57269350c621dd76c2ea2558a208448bd42b697 /tests
parentae0beee2854b977f472d48cd149b880b074b59c5 (diff)
Successfully bootstraps!!
Diffstat (limited to 'tests')
-rw-r--r--tests/test_def.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_def.c b/tests/test_def.c
new file mode 100644
index 0000000..e6f95d7
--- /dev/null
+++ b/tests/test_def.c
@@ -0,0 +1,24 @@
+
+#undef NDEBUG /* ensure tests always assert. */
+#include "upb_def.h"
+#include <stdlib.h>
+
+int main() {
+ upb_symtab *s = upb_symtab_new();
+ upb_symtab_add_descriptorproto(s);
+
+ int count;
+ upb_def **defs = upb_symtab_getdefs(s, &count, UPB_DEF_ANY);
+ for (int i = 0; i < count; i++) {
+ upb_def_unref(defs[i]);
+ }
+ free(defs);
+
+ upb_string *str = upb_strdupc("google.protobuf.FileDescriptorSet");
+ upb_def *fds = upb_symtab_lookup(s, str);
+ assert(fds != NULL);
+ assert(upb_dyncast_msgdef(fds) != NULL);
+ upb_def_unref(fds);
+ upb_string_unref(str);
+ upb_symtab_unref(s);
+}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback