From bca96119276330bf51859ab1309eefaef7f21d69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com>
Date: Tue, 3 Nov 2020 11:19:25 +0100
Subject: [PATCH] Add tests for Exceptions

---
 tests/CMakeLists.txt      |  1 +
 tests/test_Exceptions.cpp | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 tests/test_Exceptions.cpp

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b58ed3cf8..f46beee09 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 000000000..720bd40ea
--- /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
-- 
GitLab