-6

I'm running some unit tests built with catch2. Its output begins with:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_suite is a Catch v2.13.6 host application.
Run with -? for options

well, I don't want to see that. Neither I nor other users/maintainers need to be reminded of the catch2 version or of the ability to run with -?, when we ran the unit test with proper arguments and know what we're doing.

But - the -? options don't seem to tell me how to disable this message. Can I? Or do I have to manually "bastardize" the catch2 header?

Alex Reinking
  • 16,724
  • 5
  • 52
  • 86
einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • Another workaround could be to pipe the output through a program that cuts out the first few lines. – eerorika Aug 04 '21 at 21:41
  • @eerorika: I'm not writing a custom script and telling people to run that rather than the actual unit test. Grrr. – einpoklum Aug 04 '21 at 21:42
  • 1
    I’m voting to close this question because I don't see any value for it in a Q and A format. Someone would come with the same question later? Doubtful. The tone is also a bit abrasive. – Jeffrey Aug 04 '21 at 21:54

1 Answers1

2

Catch2 is open-source

If you go to src/catch2/reporters/catch_reporter_console.cpp, you'll find:

void ConsoleReporter::lazyPrintRunInfo() {
    stream << '\n' << lineOfChars('~') << '\n';
    Colour colour(Colour::SecondaryText);
    stream << currentTestRunInfo->name
        << " is a Catch v" << libraryVersion() << " host application.\n"
        << "Run with -? for options\n\n";

Just remove this last line. It should not break anything and fix your issue.

Alternatively, you can edit src/catch2/interfaces/catch_interfaces_config.hpp and add a configuration option, virtual bool printHeader(); and submit a PR. This config is used just the line after printing the header, so it is available.

Jeffrey
  • 11,063
  • 1
  • 21
  • 42