Skip to content

Commit

Permalink
fix #239 - use long macro name (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-bd authored and onqtam committed Jun 2, 2019
1 parent 35b339f commit 64e3ddc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
16 changes: 9 additions & 7 deletions doctest/doctest.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26444) // Avoid unnamed objects with custom constr
#elif DOCTEST_MSVC
#define DOCTEST_BREAK_INTO_DEBUGGER() __debugbreak()
#elif defined(__MINGW32__)
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wredundant-decls")
extern "C" __declspec(dllimport) void __stdcall DebugBreak();
DOCTEST_GCC_SUPPRESS_WARNING_POP
#define DOCTEST_BREAK_INTO_DEBUGGER() ::DebugBreak()
#else // linux
#define DOCTEST_BREAK_INTO_DEBUGGER() ((void)0)
Expand Down Expand Up @@ -996,7 +998,7 @@ namespace detail {
};

DOCTEST_INTERFACE bool checkIfShouldThrow(assertType::Enum at);

#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
[[noreturn]]
#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
Expand Down Expand Up @@ -1300,7 +1302,7 @@ namespace detail {

// clang-format off
template <int, class L, class R> struct RelationalComparator { bool operator()(const DOCTEST_REF_WRAP(L), const DOCTEST_REF_WRAP(R) ) const { return false; } };

#define DOCTEST_BINARY_RELATIONAL_OP(n, op) \
template <class L, class R> struct RelationalComparator<n, L, R> { bool operator()(const DOCTEST_REF_WRAP(L) lhs, const DOCTEST_REF_WRAP(R) rhs) const { return op(lhs, rhs); } };
// clang-format on
Expand Down Expand Up @@ -2511,11 +2513,11 @@ constexpr T to_lvalue = x;
#define DOCTEST_SCENARIO_TEMPLATE(name, T, ...) DOCTEST_TEST_CASE_TEMPLATE(" Scenario: " name, T, __VA_ARGS__)
#define DOCTEST_SCENARIO_TEMPLATE_DEFINE(name, T, id) DOCTEST_TEST_CASE_TEMPLATE_DEFINE(" Scenario: " name, T, id)

#define DOCTEST_GIVEN(name) SUBCASE(" Given: " name)
#define DOCTEST_WHEN(name) SUBCASE(" When: " name)
#define DOCTEST_AND_WHEN(name) SUBCASE("And when: " name)
#define DOCTEST_THEN(name) SUBCASE(" Then: " name)
#define DOCTEST_AND_THEN(name) SUBCASE(" And: " name)
#define DOCTEST_GIVEN(name) DOCTEST_SUBCASE(" Given: " name)
#define DOCTEST_WHEN(name) DOCTEST_SUBCASE(" When: " name)
#define DOCTEST_AND_WHEN(name) DOCTEST_SUBCASE("And when: " name)
#define DOCTEST_THEN(name) DOCTEST_SUBCASE(" Then: " name)
#define DOCTEST_AND_THEN(name) DOCTEST_SUBCASE(" And: " name)
// clang-format on

// == SHORT VERSIONS OF THE MACROS
Expand Down
14 changes: 7 additions & 7 deletions doctest/parts/doctest_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ namespace detail {
};

DOCTEST_INTERFACE bool checkIfShouldThrow(assertType::Enum at);

#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
[[noreturn]]
#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
Expand Down Expand Up @@ -1299,7 +1299,7 @@ namespace detail {

// clang-format off
template <int, class L, class R> struct RelationalComparator { bool operator()(const DOCTEST_REF_WRAP(L), const DOCTEST_REF_WRAP(R) ) const { return false; } };

#define DOCTEST_BINARY_RELATIONAL_OP(n, op) \
template <class L, class R> struct RelationalComparator<n, L, R> { bool operator()(const DOCTEST_REF_WRAP(L) lhs, const DOCTEST_REF_WRAP(R) rhs) const { return op(lhs, rhs); } };
// clang-format on
Expand Down Expand Up @@ -2510,11 +2510,11 @@ constexpr T to_lvalue = x;
#define DOCTEST_SCENARIO_TEMPLATE(name, T, ...) DOCTEST_TEST_CASE_TEMPLATE(" Scenario: " name, T, __VA_ARGS__)
#define DOCTEST_SCENARIO_TEMPLATE_DEFINE(name, T, id) DOCTEST_TEST_CASE_TEMPLATE_DEFINE(" Scenario: " name, T, id)

#define DOCTEST_GIVEN(name) SUBCASE(" Given: " name)
#define DOCTEST_WHEN(name) SUBCASE(" When: " name)
#define DOCTEST_AND_WHEN(name) SUBCASE("And when: " name)
#define DOCTEST_THEN(name) SUBCASE(" Then: " name)
#define DOCTEST_AND_THEN(name) SUBCASE(" And: " name)
#define DOCTEST_GIVEN(name) DOCTEST_SUBCASE(" Given: " name)
#define DOCTEST_WHEN(name) DOCTEST_SUBCASE(" When: " name)
#define DOCTEST_AND_WHEN(name) DOCTEST_SUBCASE("And when: " name)
#define DOCTEST_THEN(name) DOCTEST_SUBCASE(" Then: " name)
#define DOCTEST_AND_THEN(name) DOCTEST_SUBCASE(" And: " name)
// clang-format on

// == SHORT VERSIONS OF THE MACROS
Expand Down

0 comments on commit 64e3ddc

Please sign in to comment.