Skip to content

Commit

Permalink
Implement a custom doctest main
Browse files Browse the repository at this point in the history
I'm not doing anything different with it, but I've never liked having a
header-only lib provide my main for me using a custom define. Call me
old fashioned.
  • Loading branch information
jeaye committed Oct 22, 2023
1 parent 0627f4f commit 9cee841
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/cpp/main.cpp
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#define DOCTEST_CONFIG_IMPLEMENT
#include <doctest/doctest.h>

int main(int const argc, char const **argv)
{
doctest::Context context;
context.applyCommandLine(argc, argv);
context.setOption("no-breaks", true);

auto const res(context.run());
if(context.shouldExit())
{ return res; }

return res;
}

0 comments on commit 9cee841

Please sign in to comment.