I think the current naming is causing some confusion. There are seem to be three different types of messages:
These rules mean that it is easy to write code which will never output anything. For example:
SECTION("log test", "") {
{
MyFixture fixture;
CHECK(true==false);
SCOPED_INFO("Message one");
}
CHECK(true==false);
INFO("Message two");
}
Since SCOPED_INFO is not followed by a test in its block, and the INFO statement is not followed by a test in the same section they will never do anything. I think that behaviour is unexpected. I certainly was not expecting it even though I've been using CATCH for a while now.
In addition some reporters can change the rules a bit: the junit reporter for example will always output messages as specified by the junit standard, and using the -s parameter will also cause all warning macros to generate output. You can also use std::cerr and std::cout manually to output messages, but due to buffering that output will appear misplaced amongst the CATCH-generated messages which makes them effectively unusable. As a user I would like to be able to output messages unconditionally of the outcome of a test. An example: I have a couple of tests which run sanity checks on generated data files and I find it useful to have the test runner output how many data entries were checked along with some statistics. This is currently doable by using WARN, but the name is a bit misleading since this type of output is not a warning.
Having said all that I am not sure what the best way to fix this is. One option is to change SCOPED_INFO to DEBUG and document that the log level dictates when messages are output. This makes behaviour match standard logging frameworks. Another option is to do a more radical renaming to something like LOG, LOG_ON_SECTION_FAIL and LOG_ON_LOCAL_FAIL. That will result in a wall of capslock in your source though. That still means it will be easy for people to write log statements that will never trigger; I'm not sure how to prevent that.
Wichert.