Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch2 v3 integration does not work with Catch2 amalgamated releases #231

Closed
HaoZeke opened this issue Jun 21, 2024 · 2 comments
Closed

Comments

@HaoZeke
Copy link

HaoZeke commented Jun 21, 2024

Just wanted to add some notes about using Catch2v3.

  • Distributed via catch_amalgamated.{c,h}pp
#define APPROVALS_CATCH2_V3
#include "ApprovalTests.hpp"

So there's also this patch:

diff --git a/client/thirdparty/ApprovalTests.hpp b/client/thirdparty/ApprovalTests.hpp
index 35199074..025c94e6 100644
--- a/client/thirdparty/ApprovalTests.hpp
+++ b/client/thirdparty/ApprovalTests.hpp
@@ -2235,7 +2235,7 @@ namespace ApprovalTests
 #ifdef APPROVALS_CATCH
 #define APPROVAL_TESTS_INCLUDE_CPPS
 
-#include "catch2/catch_amalgamated.hpp"
+#include <catch2/catch.hpp>
 
 //namespace ApprovalTests {
 struct Catch2ApprovalListener : Catch::TestEventListenerBase
@@ -2307,7 +2307,10 @@ CATCH_REGISTER_LISTENER(Catch2TestCommitRevert)
 #ifdef APPROVALS_CATCH2_V3
 #define APPROVAL_TESTS_INCLUDE_CPPS
 
-#include "catch2/catch_amalgamated.hpp"
+#include <catch2/reporters/catch_reporter_event_listener.hpp>
+#include <catch2/catch_test_macros.hpp>
+#include <catch2/reporters/catch_reporter_registrars.hpp>
+#include <catch2/catch_test_case_info.hpp>
 
 //namespace ApprovalTests {
 struct Catch2ApprovalListener : Catch::EventListenerBase

... and that's it. Should have a docs PR soon.

@claremacrae claremacrae changed the title DOC: Unintuitive Catch2v3 usage Catch2 v3 integration does not work with Catch2 amalgamated releases Jul 2, 2024
claremacrae added a commit that referenced this issue Jul 2, 2024
claremacrae added a commit that referenced this issue Jul 2, 2024
@claremacrae
Copy link
Collaborator

Hello @HaoZeke,

Thanks very much for telling us about this, and for offering a PR on the documentation.

Rather than documenting a manual edit to the ApprovalTests.cpp code, we have made it so that the project will build with both Catch2 v3 layouts.

And the documentation is updated here:

https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/UsingCatch2v3.md

Basically, use APPROVALS_CATCH2_V3_AMALGAMATED in your main.cpp instead of APPROVALS_CATCH2_V3.

If you build against the master branch of this project, it should just work.

Otherwise, we may be able to do a release at the end of this month.

Thanks again.

@HaoZeke
Copy link
Author

HaoZeke commented Jul 2, 2024

Thanks a ton for working on this, that's a much more elegant fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants