summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-02-05 22:07:10 -0800
committerJoshua Haberman <joshua@reverberate.org>2011-02-05 22:07:10 -0800
commit806ba1c80d86bd59759cf59efc057662eecbcf65 (patch)
treed30146be1313d6be6818cb1c613fc4ea26b9a7d1 /tests
parent3affb319260263efc3cee502896d9f981186c7da (diff)
Another round of fixes.
test_vs_proto2.googlemessage1 passes again, with no memory leaks!
Diffstat (limited to 'tests')
-rw-r--r--tests/test_stream.c2
-rw-r--r--tests/test_vs_proto2.cc12
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/test_stream.c b/tests/test_stream.c
index b6d511c..468d40c 100644
--- a/tests/test_stream.c
+++ b/tests/test_stream.c
@@ -87,7 +87,7 @@ static void test_dispatcher() {
upb_set_handler_closure(&h, &data, NULL);
upb_dispatcher d;
upb_dispatcher_init(&d);
- upb_dispatcher_reset(&d, &h);
+ upb_dispatcher_reset(&d, &h, false);
upb_dispatch_startmsg(&d);
upb_value val;
diff --git a/tests/test_vs_proto2.cc b/tests/test_vs_proto2.cc
index bf0296c..9633420 100644
--- a/tests/test_vs_proto2.cc
+++ b/tests/test_vs_proto2.cc
@@ -79,6 +79,7 @@ void compare_arrays(const google::protobuf::Reflection *r,
}
}
+#include <inttypes.h>
void compare_values(const google::protobuf::Reflection *r,
const google::protobuf::Message& proto2_msg,
const google::protobuf::FieldDescriptor *proto2_f,
@@ -176,9 +177,15 @@ void parse_and_compare(MESSAGE_CIDENT *proto2_msg,
// Parse to both proto2 and upb.
ASSERT(proto2_msg->ParseFromArray(upb_string_getrobuf(str), upb_string_len(str)));
upb_status status = UPB_STATUS_INIT;
+ upb_msg_clear(upb_msg, upb_md);
upb_strtomsg(str, upb_msg, upb_md, &status);
- ASSERT(upb_ok(&status));
+ if (!upb_ok(&status)) {
+ fprintf(stderr, "Error parsing test protobuf: ");
+ upb_printerr(&status);
+ exit(1);
+ }
compare(*proto2_msg, upb_msg, upb_md);
+ upb_status_uninit(&status);
}
int main(int argc, char *argv[])
@@ -252,8 +259,11 @@ int main(int argc, char *argv[])
upb_msg_unref(upb_msg, msgdef);
upb_def_unref(UPB_UPCAST(msgdef));
+ upb_def_unref(fds_msgdef);
upb_string_unref(str);
upb_symtab_unref(symtab);
+ upb_status_uninit(&status);
+ google::protobuf::ShutdownProtobufLibrary();
return 0;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback