1

Using the Catch single-include unit-tester, I have (passing) tests like this

TEST_CASE ("sizes", "[metadata]" ) {
    INFO ( "The number is " << 42 );
    REQUIRE (sizeof(some_struct) == 16);
}

The documentation (linked above) states that the INFO is logged to a buffer, but I haven't figured out how to dump or otherwise retrieve the buffer. The message is not printed to my console, but other things I printf or shove into cout and cerror do print, so my i/o is set up correctly. I tried reading the source to find out where messages are stowed, but it's big and involved. I wonder if someone just happens to know how to retrieve the messages?

philsquared
  • 22,403
  • 12
  • 69
  • 98
Reb.Cabin
  • 5,426
  • 3
  • 35
  • 64
  • 1
    Did you look at the `INFO` macro to see what it's doing? Maybe trace into it in a debugger to see where it leads. – Captain Obvlious Jul 02 '14 at 03:20
  • Yeah, the debugger `gdb` fails to load the executable (just says "File format not recognized.") The macro calls into the guts of the octopus, into a variable named "Info," for which there are almost 700 matches in the file. Reading the source bottom-up was going to be time-consuming, and that's why I posted the question: to see whether someone just happened to know. – Reb.Cabin Jul 02 '14 at 14:21
  • The `gdb` problem was traced to mixed linking of C and C++ and eliminated. But it looks like the catch functions are aggressively inlined, so my attempt to step into `INFO` doesn't do anything. Still looking for advice. – Reb.Cabin Jul 02 '14 at 15:26

1 Answers1

1

Looks like this is the intended behavior: INFO is reported only on failure. See https://github.com/philsquared/Catch/issues/290

Reb.Cabin
  • 5,426
  • 3
  • 35
  • 64
  • That is, indeed, the case. If you want it to print the message regardless of failure you can use WARN. I'm aware that that is not ideal and I have it on my soft list to look at adding an alternative. – philsquared Jul 03 '14 at 05:42