diff --git a/apps/components_tests/esm/testrefid.cpp b/apps/components_tests/esm/testrefid.cpp index 8a69b62d74..1911cd1a5a 100644 --- a/apps/components_tests/esm/testrefid.cpp +++ b/apps/components_tests/esm/testrefid.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include diff --git a/apps/components_tests/lua/test_async.cpp b/apps/components_tests/lua/test_async.cpp index 41a3cfc045..e4010e319f 100644 --- a/apps/components_tests/lua/test_async.cpp +++ b/apps/components_tests/lua/test_async.cpp @@ -3,12 +3,11 @@ #include #include -#include +#include namespace { using namespace testing; - using namespace TestingOpenMW; struct LuaCoroutineCallbackTest : Test { diff --git a/apps/components_tests/lua/test_configuration.cpp b/apps/components_tests/lua/test_configuration.cpp index f2badde878..4d48927ecc 100644 --- a/apps/components_tests/lua/test_configuration.cpp +++ b/apps/components_tests/lua/test_configuration.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include namespace diff --git a/apps/components_tests/lua/test_lua.cpp b/apps/components_tests/lua/test_lua.cpp index d5bc1eb7bf..09f0151267 100644 --- a/apps/components_tests/lua/test_lua.cpp +++ b/apps/components_tests/lua/test_lua.cpp @@ -2,6 +2,7 @@ #include #include +#include #include namespace diff --git a/apps/components_tests/lua/test_serialization.cpp b/apps/components_tests/lua/test_serialization.cpp index f9368b7a06..cff41dde9a 100644 --- a/apps/components_tests/lua/test_serialization.cpp +++ b/apps/components_tests/lua/test_serialization.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include namespace { diff --git a/apps/components_tests/lua/test_utilpackage.cpp b/apps/components_tests/lua/test_utilpackage.cpp index 6f022031b7..3eb22a9a46 100644 --- a/apps/components_tests/lua/test_utilpackage.cpp +++ b/apps/components_tests/lua/test_utilpackage.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace { diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 348007cd58..fb5718a979 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -513,6 +513,7 @@ else () endif() add_component_dir(testing + expecterror util ) diff --git a/components/testing/expecterror.hpp b/components/testing/expecterror.hpp new file mode 100644 index 0000000000..abd59124af --- /dev/null +++ b/components/testing/expecterror.hpp @@ -0,0 +1,20 @@ +#ifndef OPENMW_COMPONENTS_TESTING_EXPECTERROR_H +#define OPENMW_COMPONENTS_TESTING_EXPECTERROR_H + +#include +#include + +#include + +#define EXPECT_ERROR(X, ERR_SUBSTR) \ + try \ + { \ + X; \ + FAIL() << "Expected error"; \ + } \ + catch (const std::exception& e) \ + { \ + EXPECT_THAT(e.what(), ::testing::HasSubstr(ERR_SUBSTR)); \ + } + +#endif diff --git a/components/testing/util.hpp b/components/testing/util.hpp index 81c5d181db..65dbfe927d 100644 --- a/components/testing/util.hpp +++ b/components/testing/util.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -80,15 +81,4 @@ namespace TestingOpenMW } } -#define EXPECT_ERROR(X, ERR_SUBSTR) \ - try \ - { \ - X; \ - FAIL() << "Expected error"; \ - } \ - catch (const std::exception& e) \ - { \ - EXPECT_THAT(e.what(), ::testing::HasSubstr(ERR_SUBSTR)); \ - } - #endif