MSVC reporter and a couple of changes to remove MSVC warnings when using /Wall #106

wants to merge 6 commits into


None yet

4 participants

ibond commented Jul 26, 2012

The primary change here is adding a new reporter type to print errors and warnings in a format that can be parsed by Visual Studio and put into the Error List window.

This is useful because I set the test executable to be run automatically as a post-build step so the build is considered failed if any of the tests fail. With the MSVC reporter the errors and warnings show up in the Error List window just like compiler errors and double clicking on them takes me directly to the failing test.

The MSVC reporter output is almost identical to the basic reporter so I extended that rather than copy/pasting the code. I did have to make some changes to the basic reporter code however the output from the basic reporter should remain unchanged.

Ian Bond added some commits Jul 14, 2012
Ian Bond Added a Microsoft Visual Studio test reporter.
This is essentially the same as the basic reporter, however it formats the
output slightly differently and adds "error:" and "warning:" in the appropriate
places to have those lines show up in Visual Studio's Error List window.  This
is useful when setting the test executable to automatically run as a post-build

Ian Bond Added 'TextColour::None' to mapConsoleColour to prevent a warning whe…
…n compiling

with MSVC 2010 when compiling with /Wall.

warning C4061: enumerator 'None' in switch of enum 'Catch::TextColour::Colours' is not explicitly handled by a case label
Ian Bond Replaced tabs that were added in the past 2 commits with 4 spaces. 00ab4fd
Ian Bond Regenerated single_include/catch.hpp to include changes made in previ…
…ous 3 commits.
Ian Bond Fixed MsvcReporter in reponse to the rename of IReporterConfig to

Added an explict and private assignment operator to ReporterConfig to prevent
warning C4512 in MSVC 2010.

Rebuilt single_include/catch.hpp.
Ian Bond On MSVC 2010 /Wall the CATCH_INTERNAL_LINEINFO macro was emitting the
following warning:

  warning C4365: 'argument' : conversion from 'long' to 'size_t',
    signed/unsigned mismatch

To fix this I changed the __LINE__ usages to static_cast<std::size_t>(__LINE__).

It's kind of silly that MSVC is flagging this as a warning since it's a numeric

I'd meant to comment on this ages ago but it dropped off my radar - sorry about that (and thanks to @martinmoene for prompting me).

I was holding off doing anything with this as I was making some major changes to the reporting interface. Those changes are mostly complete now, so this is a good time to give this another look.

Thanks for making this available.

ibond commented Dec 27, 2012

No problem, I imagine that you can take the general idea even if the pull isn't compatible with the new reporting interface. Feel free to ask if you have any questions.


Hi again,

The new reporter interface and implementations are fairly stable now. I use the console reporter in MSVC's output window all the time and the file/ line following works fine for me.
Can you confirm that this does everything your original pull request set out to do?

ibond commented Apr 22, 2013

It works in the output window (I can double click the error message and it brings me to the right file/line), but it looks like it's missing the "error :" or "warning :" text on the output which is what is used to populate the Error List (In VS2010 View->Error List). I think the multiline error message would also not show up in the Error List, but the text that's printed from the basic reporter should work.

d-led commented Sep 16, 2013

so, ist it coming up? Bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment