From cf674646e95d3b54be3c2b16066bbcdddd728ff4 Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Wed, 8 Jul 2020 19:27:31 +0300 Subject: [PATCH] [base] Tests on returns void case for all kinds of exceptions catcher. --- base/base_tests/exception_tests.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/base/base_tests/exception_tests.cpp b/base/base_tests/exception_tests.cpp index 8b1f9bb5b6..dfa3512387 100644 --- a/base/base_tests/exception_tests.cpp +++ b/base/base_tests/exception_tests.cpp @@ -17,6 +17,11 @@ int FuncThrowsRootExceptionArg(int) { throw RootException("RootException", "Root int FuncThrowsExceptionArg(int) { throw std::exception(); } int FuncThrowsNumberArg(int) { throw 1; }; +void FuncDoesNotThrowVoid(int) noexcept { return; } +void FuncThrowsRootExceptionVoid(int) { throw RootException("RootException", "RootException"); } +void FuncThrowsExceptionVoid() { throw std::exception(); } +void FuncThrowsNumberVoid() { throw 1; }; + UNIT_TEST(ExceptionCatcher_FunctionsWithoutArgs) { ExceptionCatcher("Function without arg.", FuncDoesNotThrow); @@ -45,4 +50,12 @@ UNIT_TEST(ExceptionCatcher_Lambdas) ExceptionCatcher( "Lambda", [](int) -> int { throw 1; }, 7); } + +UNIT_TEST(ExceptionCatcher_FunctionsReturnVoid) +{ + ExceptionCatcher("Function returns void.", FuncDoesNotThrowVoid, 7); + ExceptionCatcher("Function returns void.", FuncThrowsRootExceptionVoid, 7); + ExceptionCatcher("Function returns void.", FuncThrowsExceptionVoid); + ExceptionCatcher("Function returns void..", FuncThrowsNumberVoid); +} } // namespace