diff options
author | Joshua Haberman <joshua@reverberate.org> | 2011-02-05 22:07:10 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2011-02-05 22:07:10 -0800 |
commit | 806ba1c80d86bd59759cf59efc057662eecbcf65 (patch) | |
tree | d30146be1313d6be6818cb1c613fc4ea26b9a7d1 /tests/test_vs_proto2.cc | |
parent | 3affb319260263efc3cee502896d9f981186c7da (diff) |
Another round of fixes.
test_vs_proto2.googlemessage1 passes again,
with no memory leaks!
Diffstat (limited to 'tests/test_vs_proto2.cc')
-rw-r--r-- | tests/test_vs_proto2.cc | 12 |
1 files changed, 11 insertions, 1 deletions
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; } |