diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2019-03-06 12:17:34 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-06 12:17:34 -0800 |
commit | ed9faae0993704b033c594b072d65e1bf19207fa (patch) | |
tree | df2777687abddf1335427d06942ba3436edf8c0b /tests/test_handlers.c | |
parent | 51f30e064b8e88af8e7d429c5a54c25f28c68b02 (diff) | |
parent | 71ec01e34b03557cfed9df5f417791a189e7fca6 (diff) |
Merge pull request #141 from haberman/defcleanup
Major refactoring/cleanup of upb
Diffstat (limited to 'tests/test_handlers.c')
-rw-r--r-- | tests/test_handlers.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/tests/test_handlers.c b/tests/test_handlers.c deleted file mode 100644 index fe6fb82..0000000 --- a/tests/test_handlers.c +++ /dev/null @@ -1,41 +0,0 @@ - -#include "upb/handlers.h" -#include "upb/descriptor/descriptor.upbdefs.h" -#include "upb_test.h" -#include <stdlib.h> -#include <string.h> - -static bool startmsg(void *c, const void *hd) { - UPB_UNUSED(c); - UPB_UNUSED(hd); - return true; -} - -static void test_error() { - /* Test creating handlers of a static msgdef. */ - const upb_msgdef *m = upbdefs_google_protobuf_DescriptorProto_get(&m); - upb_handlers *h = upb_handlers_new(m, &h); - upb_msgdef_unref(m, &m); - - /* Attempt to set the same handler twice causes error. */ - ASSERT(upb_ok(upb_handlers_status(h))); - upb_handlers_setstartmsg(h, &startmsg, NULL); - ASSERT(upb_ok(upb_handlers_status(h))); - upb_handlers_setstartmsg(h, &startmsg, NULL); - ASSERT(!upb_ok(upb_handlers_status(h))); - ASSERT(!upb_handlers_freeze(&h, 1, NULL)); - - /* Clearing the error will let us proceed. */ - upb_handlers_clearerr(h); - ASSERT(upb_handlers_freeze(&h, 1, NULL)); - ASSERT(upb_handlers_isfrozen(h)); - - upb_handlers_unref(h, &h); -} - -int run_tests(int argc, char *argv[]) { - UPB_UNUSED(argc); - UPB_UNUSED(argv); - test_error(); - return 0; -} |