updated build system
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
@ -38,6 +38,12 @@ TEST(utils_error, check_default_exception_handler) {
|
||||
|
||||
TEST(utils_error, can_override_exception_handler) {
|
||||
struct my_exc_handler final : public utils::error::i_exception_handler {
|
||||
#if defined(PROJECT_ENABLE_V2_ERRORS)
|
||||
MOCK_METHOD(void, handle_debug,
|
||||
(std::string_view function_name, std::string_view msg),
|
||||
(const, override));
|
||||
#endif // defined(PROJECT_ENABLE_V2_ERRORS)
|
||||
|
||||
MOCK_METHOD(void, handle_error,
|
||||
(std::string_view function_name, std::string_view msg),
|
||||
(const, override));
|
||||
@ -48,11 +54,30 @@ TEST(utils_error, can_override_exception_handler) {
|
||||
MOCK_METHOD(void, handle_exception,
|
||||
(std::string_view function_name, const std::exception &ex),
|
||||
(const, override));
|
||||
|
||||
#if defined(PROJECT_ENABLE_V2_ERRORS)
|
||||
MOCK_METHOD(void, handle_info,
|
||||
(std::string_view function_name, std::string_view msg),
|
||||
(const, override));
|
||||
|
||||
MOCK_METHOD(void, handle_trace,
|
||||
(std::string_view function_name, std::string_view msg),
|
||||
(const, override));
|
||||
|
||||
MOCK_METHOD(void, handle_warn,
|
||||
(std::string_view function_name, std::string_view msg),
|
||||
(const, override));
|
||||
#endif // defined(PROJECT_ENABLE_V2_ERRORS)
|
||||
};
|
||||
|
||||
my_exc_handler handler{};
|
||||
utils::error::set_exception_handler(&handler);
|
||||
|
||||
#if defined(PROJECT_ENABLE_V2_ERRORS)
|
||||
EXPECT_CALL(handler, handle_debug("test_func", "debug")).WillOnce(Return());
|
||||
utils::error::handle_debug("test_func", "debug");
|
||||
#endif // defined(PROJECT_ENABLE_V2_ERRORS)
|
||||
|
||||
EXPECT_CALL(handler, handle_error("test_func", "error")).WillOnce(Return());
|
||||
utils::error::handle_error("test_func", "error");
|
||||
|
||||
@ -68,6 +93,17 @@ TEST(utils_error, can_override_exception_handler) {
|
||||
});
|
||||
utils::error::handle_exception("test_func_ex", ex);
|
||||
|
||||
#if defined(PROJECT_ENABLE_V2_ERRORS)
|
||||
EXPECT_CALL(handler, handle_info("test_func", "info")).WillOnce(Return());
|
||||
utils::error::handle_info("test_func", "info");
|
||||
|
||||
EXPECT_CALL(handler, handle_trace("test_func", "trace")).WillOnce(Return());
|
||||
utils::error::handle_trace("test_func", "trace");
|
||||
|
||||
EXPECT_CALL(handler, handle_warn("test_func", "warn")).WillOnce(Return());
|
||||
utils::error::handle_warn("test_func", "warn");
|
||||
#endif // defined(PROJECT_ENABLE_V2_ERRORS)
|
||||
|
||||
utils::error::set_exception_handler(&utils::error::default_exception_handler);
|
||||
}
|
||||
} // namespace repertory
|
||||
|
Reference in New Issue
Block a user