-
Notifications
You must be signed in to change notification settings - Fork 50
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
CombinationApprovals snippet does not compile with single header #90
Comments
The build output is:
|
This is a minimal example that fails to compile with XCode: #include "catch2/catch.hpp"
#include "ApprovalTests/CombinationApprovals.h"
#include "PairUtilities.h"
using namespace ApprovalTests;
TEST_CASE("YouCanVerifyCombinationsOf2")
{
std::vector<std::string> v{"hello", "world"};
std::vector<int> numbers{1, 2, 3};
CombinationApprovals::verifyAllCombinations(
[](std::string s, int i) { return std::make_pair(s, i); }, v, numbers);
} Output is:
|
If I switch the 2nd and 3rd header, it works fine: #include "catch2/catch.hpp"
#include "PairUtilities.h"
#include "ApprovalTests/CombinationApprovals.h" Is this actually reasonable behaviour? Or do we need to do something like in catchorg/Catch2#1405 |
I wonder if this is a rediscovery of #6 |
Notes for future us: One issue is that we are not releasing the PairUtilities.h function - so the snippet code, as published, is expected not to work. We could work around that by adding this code - but adding code to namespace std
{
std::ostream& operator<<(std::ostream& os,
const std::pair<std::string, int>& pair)
{
os << "(" << pair.first << ", " << pair.second << ")";
return os;
}
} |
The code above is no longer in the documentation |
Steps to reproduce:
ApprovalTests.v.7.0.0.hpp
(from the releases page) calledApprovalTests.v.7.0.0_hacked_catch_include.hpp
- with this change:cmake -G "Ninja" -DCMAKE_UNITY_BUILD=yes
It will fail to compile - as noted in #89 (comment)
I believe that this is related to Catch's issue 1405 - linked from the comment above.
The text was updated successfully, but these errors were encountered: