diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b58ed3cf808860f9500755dd1cebecb1e255d05f..f46beee09929338869dd8c5adc9e8fcab39e762a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -61,6 +61,7 @@ add_executable (unit_tests test_DoWhileProcessor.cpp test_EmbeddedData.cpp test_EscapedString.cpp + test_Exceptions.cpp test_ExecutionPolicy.cpp test_FakeProcessor.cpp test_ForProcessor.cpp diff --git a/tests/test_Exceptions.cpp b/tests/test_Exceptions.cpp new file mode 100644 index 0000000000000000000000000000000000000000..720bd40ea73cfa529b90018fcc2fdcdd12c2603d --- /dev/null +++ b/tests/test_Exceptions.cpp @@ -0,0 +1,25 @@ +#ifndef TEST_EXCEPTIONS_HPP +#define TEST_EXCEPTIONS_HPP + +#include <catch2/catch.hpp> + +#include <utils/Exceptions.hpp> + +// clazy:excludeall=non-pod-global-static + +TEST_CASE("Exceptions", "[utils]") +{ + SECTION("exceptions message") + { + RawError raw_error{"a raw error"}; + REQUIRE(std::string{raw_error.what()} == "a raw error"); + + UnexpectedError unexpected_error{"an unexpected error"}; + REQUIRE(std::string{unexpected_error.what()} == "unexpected error: an unexpected error"); + + NotImplementedError not_implemented_error{"not implemented error"}; + REQUIRE(std::string{not_implemented_error.what()} == "not implemented yet: not implemented error"); + } +} + +#endif // TEST_EXCEPTIONS_HPP