tests: rely on doctest+trompeloeil integration from upstream
There's been a behavior change in doctest 2.8.9 which changed how
strings are printed. This was fixed in Trompeloeil v43. Unfortunately,
we were bundling that one trivial file that sends error info from
Trompeloeil to Doctest, and that means that we were not getting the fix
from Trompeloeil. As a result, failed expectations were printed as a
pointer instead of the usual useful text.
Why did we bundle this? That's an excellent question. It goes back to
cla-sysrepo and pre-doctest days. It appears to have been introduced
back when we switched from Catch v1 to Catch v2 in cla-sysrepo's commit
59cc09af22899579a354c2ab1c6ae2f1ae40ac2d. That in itself was just a
modification to something from cla-sysrepo commit
321a3424a179e41df7bb43d101cf853993ef1c00 which refers to the upstream
wiki. Chances are that they were not providing the
`$UnitTestFramework/trompeloeil.hpp` file, so we might have had to
copy-paste like that.
Seven years later, let's just make our lives easier.
Bug: https://github.com/rollbear/trompeloeil/issues/279
Change-Id: I926951e106c8b2aa4eb5eb8e3481e046021ddcde
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d6b4a0..7fef00c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -247,8 +247,8 @@
if(BUILD_TESTING)
- find_package(trompeloeil 33 REQUIRED)
- find_package(doctest 2.3.1 REQUIRED)
+ find_package(trompeloeil 45 REQUIRED)
+ find_package(doctest 2.4.11 REQUIRED)
add_library(DoctestIntegration STATIC
tests/doctest_integration.cpp
diff --git a/tests/doctest_integration.cpp b/tests/doctest_integration.cpp
index 4538dde..0a3f254 100644
--- a/tests/doctest_integration.cpp
+++ b/tests/doctest_integration.cpp
@@ -1,20 +1,2 @@
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>
-#include <trompeloeil.hpp>
-
-namespace trompeloeil {
-template <>
-void reporter<specialized>::send(
- severity s,
- const char* file,
- unsigned long line,
- const char* msg)
-{
- auto f = line ? file : "[file/line unavailable]";
- if (s == severity::fatal) {
- ADD_FAIL_AT(f, line, msg);
- } else {
- ADD_FAIL_CHECK_AT(f, line, msg);
- }
-}
-}
diff --git a/tests/trompeloeil_doctest.hpp b/tests/trompeloeil_doctest.hpp
index 5546929..3587dcb 100644
--- a/tests/trompeloeil_doctest.hpp
+++ b/tests/trompeloeil_doctest.hpp
@@ -16,6 +16,4 @@
#define REQUIRE_THROWS_WITH(expr, e) DOCTEST_REQUIRE_THROWS_WITH(static_cast<void>(expr), e)
#define REQUIRE_NOTHROW(expr) DOCTEST_REQUIRE_NOTHROW(static_cast<void>(expr))
-extern template struct trompeloeil::reporter<trompeloeil::specialized>;
-
void waitForCompletionAndBitMore(const trompeloeil::sequence& seq);