Catch2 icon indicating copy to clipboard operation
Catch2 copied to clipboard

Use of INFO

Open mintyc opened this issue 11 years ago • 3 comments

IMO INFO currently is limited because it is scoped. It can only be used in the TEST_CASE body itself, not in mocks etc.

I would like to be able to log supplementary information that via the command line I can force to be output irrespective of whether an assertion fails.

Say I have some mock classes that I use in tests, I'd like them to be able to output INFO but they are scoped such that the INFO will never get out. e.g. I have mocks of element types, Copyable, Movable etc and as well as asserting on numbers of constructions, move assignments etc in the test case itself, I sometimes want individual calls into the various methods to log a copy construction etc.

The existing behaviour of WARN can do this, but tags messages with 'warning' and is always on.

I'd propose existing INFO is renamed SCOPED to convey its restricted (but useful) purpose and INFO is repurposed to become more like WARN with the exception that it is only logged when explicitly requested on the command line.

mintyc avatar May 13 '15 10:05 mintyc

Hi @mintyc. Sorry it's been a long time getting this (I'm just seeing it for the first time during an old tickets review). Is this still something that's relevant to you?

Ironically what you proposed used to be the case: INFO worked unscoped, and there was a separate SCOPED_INFO that had the behaviour that INFO now does. But I kept getting reports from people who found the behaviour of INFO surprising so eventually changed it to the scoped behaviour. So perhaps the solution would be a separate macro for the unscoped case? UNSCOPED_INFO doesn't sound like a great name, but you get the idea?

Anyway I'm going to put this back on the queue as a feature request.

philsquared avatar Mar 10 '17 14:03 philsquared

Sounds good 👍

mintyc avatar Mar 11 '17 08:03 mintyc

UNSCOPED_INFO is a thing now.

horenmar avatar Mar 06 '19 21:03 horenmar