diff options
author | Josh Haberman <jhaberman@gmail.com> | 2014-07-29 16:12:53 -0700 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2014-07-29 16:12:53 -0700 |
commit | 43f2455cbda22c513f2885d760ca2766b23e100f (patch) | |
tree | 3068031b1f5cc16e530ad25408a3c5a7554a7a28 /tests/test_cpp.cc | |
parent | d493500abc6def6b62d664990ed821e0a836a6cf (diff) |
Added UPB_UNTRACKED_REF and some more handler overload options.
Diffstat (limited to 'tests/test_cpp.cc')
-rw-r--r-- | tests/test_cpp.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_cpp.cc b/tests/test_cpp.cc index 370c7b0..7ca5a0d 100644 --- a/tests/test_cpp.cc +++ b/tests/test_cpp.cc @@ -433,6 +433,25 @@ class StringBufTesterSizeTMethodNoHandlerDataNoHandle } }; +class StringBufTesterBoolMethodNoHandlerDataNoHandle + : public StringBufTesterBase { + public: + typedef StringBufTesterBoolMethodNoHandlerDataNoHandle ME; + void Register(upb::Handlers* h, const upb::FieldDef* f) { + UPB_UNUSED(f); + ASSERT(h->SetStringHandler(f, UpbMakeHandler(&ME::Handler))); + handler_data_val_ = kExpectedHandlerData; + } + + private: + bool Handler(const char *buf, size_t len) { + ASSERT(buf == &buf_); + seen_ = true; + len_ = len; + return true; + } +}; + class StartMsgTesterBase { public: // We don't need the FieldDef it will create, but the test harness still @@ -1124,6 +1143,7 @@ int run_tests(int argc, char *argv[]) { TestHandler<StringBufTesterVoidFunctionWithHandlerDataNoHandle>(); TestHandler<StringBufTesterVoidFunctionWithHandlerDataWithHandle>(); TestHandler<StringBufTesterSizeTMethodNoHandlerDataNoHandle>(); + TestHandler<StringBufTesterBoolMethodNoHandlerDataNoHandle>(); TestMismatchedTypes(); |