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

ReporterFactoryTests.cpp fails to build with doctest 2.4.2 #168

Closed
claremacrae opened this issue Jan 6, 2021 · 2 comments
Closed

ReporterFactoryTests.cpp fails to build with doctest 2.4.2 #168

claremacrae opened this issue Jan 6, 2021 · 2 comments

Comments

@claremacrae
Copy link
Collaborator

We bundle doctest 2.4.1, which works fine.

However a change in doctest 2.4.2 results in this error message:

[ 85%] Building CXX object approvaltests.cpp_build/tests/DocTest_Tests/CMakeFiles/DocTest_Tests.dir/reporters/ReporterFactoryTests.cpp.o
In file included from /Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp.CMakeSamples/ApprovalTests.cpp/tests/DocTest_Tests/reporters/ReporterFactoryTests.cpp:8:
/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp.CMakeSamples/ApprovalTests.cpp/tests/DocTest_Tests/reporters/ReporterFactoryTests.cpp: In lambda function:
/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp.CMakeSamples/ApprovalTests.cpp/tests/DocTest_Tests/reporters/ReporterFactoryTests.cpp:38:46: error: no match for 'operator+' (operand types are 'doctest::detail::MessageBuilder' and 'const char* const')
   38 |         INFO(std::string("Reporter name = ") + reporterName);
      |                                              ^ ~~~~~~~~~~~~
      |                                                |
      |                                                const char* const
/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp.CMakeSamples/doctest/doctest/doctest.h:1989:19: note: in definition of macro 'DOCTEST_INFO_IMPL'
 1989 |         mb_name * __VA_ARGS__;                                                                     \
      |                   ^~~~~~~~~~~
/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp.CMakeSamples/doctest/doctest/doctest.h:2499:14: note: in expansion of macro 'DOCTEST_INFO'
 2499 | #define INFO DOCTEST_INFO
      |              ^~~~~~~~~~~~
/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp.CMakeSamples/ApprovalTests.cpp/tests/DocTest_Tests/reporters/ReporterFactoryTests.cpp:38:9: note: in expansion of macro 'INFO'
   38 |         INFO(std::string("Reporter name = ") + reporterName);
      |         ^~~~
make[2]: *** [approvaltests.cpp_build/tests/DocTest_Tests/CMakeFiles/DocTest_Tests.dir/reporters/ReporterFactoryTests.cpp.o] Error 1
make[1]: *** [approvaltests.cpp_build/tests/DocTest_Tests/CMakeFiles/DocTest_Tests.dir/all] Error 2
make: *** [all] Error 2
@claremacrae
Copy link
Collaborator Author

It turns out that values can be combined in INFO statements using , - so the + is not needed.

See the docs

@claremacrae
Copy link
Collaborator Author

However, changing the test to separate values with a , causes the build to fail with doctest 2.4.1:

[ 59%] Building CXX object tests/DocTest_Tests/CMakeFiles/DocTest_Tests.dir/reporters/ReporterFactoryTests.cpp.o
/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp/tests/DocTest_Tests/reporters/ReporterFactoryTests.cpp:38:47: error: too many arguments provided to function-like macro invocation
        INFO(std::string("Reporter name = "), reporterName);
                                              ^
/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp/third_party/doctest/include/doctest/doctest.2.3.7.h:1935:9: note: macro 'DOCTEST_INFO' defined here
#define DOCTEST_INFO(expression)                                                                   \
        ^
/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp/tests/DocTest_Tests/reporters/ReporterFactoryTests.cpp:38:9: error: use of undeclared identifier 'DOCTEST_INFO'
        INFO(std::string("Reporter name = "), reporterName);
        ^
/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp/third_party/doctest/include/doctest/doctest.2.3.7.h:2454:14: note: expanded from macro 'INFO'
#define INFO DOCTEST_INFO
             ^
2 errors generated.
make[3]: *** [tests/DocTest_Tests/CMakeFiles/DocTest_Tests.dir/reporters/ReporterFactoryTests.cpp.o] Error 1

claremacrae added a commit that referenced this issue Jan 6, 2021
And still build with doctest <= 2.4.1
claremacrae added a commit to claremacrae/ApprovalTests.cpp.CMakeSamples that referenced this issue Jan 6, 2021
… most dependencies

As this project has CI builds run every week, this should allow me to detect
earlier any breakages in ApprovalTests.cpp code due to dependencies updating.

For the value of this, see
approvals/ApprovalTests.cpp#168

Notes:
* Catch2 uses v2.x, as we don't yet support v3
* Boost uses 1.72.0 - see #1 for why.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant