-
Notifications
You must be signed in to change notification settings - Fork 371
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
maint: Use Catch2 instead of doctest #3618
Changes from 19 commits
c08aaee
1666415
41c0003
bb7f592
a6d9613
983f0a4
21a772d
87ad29d
5f69b0d
a3e196a
5f61e06
b2c117a
26b4d3e
1ab211d
f1d10ac
ed34065
8950c37
49e456f
1bf9ce0
f392b7a
bad03cd
f75b6e4
c37538f
e6fb1a7
a4160d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN | ||
#define CATCH_CONFIG_MAIN | ||
|
||
#include <doctest/doctest.h> | ||
#include <catch2/catch_all.hpp> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifdef _WIN32 | ||
|
||
// Catch compiled on `conda-forge` for MSVC doesn't support outputting `string_view`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a funny part There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think conda-forge compiles this lib for c++11 (or 14) under MSVC. On the other hand, when we include the header file, the automatic detection works fine, so the header part is included. Unfortunately, an approach "1 binary works for everyone" doesn't work for C/C++ projects and by using these libraries published to |
||
// So we have to define StringMaker for it ourselves. | ||
// The declaration is present though, so this only causes link errors. | ||
|
||
#include <string> | ||
#include <string_view> | ||
|
||
#include <catch2/catch_tostring.hpp> | ||
|
||
namespace Catch | ||
{ | ||
|
||
std::string StringMaker<std::string_view>::convert(std::string_view str) | ||
{ | ||
return std::string(str); | ||
} | ||
|
||
} | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows us to enable nice output for many std types without having to write implementations ourselves (this is from Catch's source code):