Hey CLion, quick: Catch!

Posted by on Sep 3, 2015 in c++, tools | 2 Comments
Hey CLion, quick: Catch!

 

I am glad I finally made up my mind and bought a personal license for CLion.

And just one day after CLion 1.1 came out.

A few episodes of CppCast had left me with some interesting sounding projects I had meant to take a look at.

One of them was Catch, with its promise of low setup cost, compared to other testing frameworks.

I quickly got it running in CLion. It really is easy to set up, being a single header file.

 

This is what the CLion window looks like in distraction free mode (I really like that mode) and after running it:

Clion running a small Catch test project

Clion running a small Catch test project

 

Looks good, but since I’m really nit picky, heres a list of a few issues I would like to see fixed:

1 – Creating a second test cases confuses CLion’s code parser to the point where it thinks we are defining a duplicate function.

I get this warning message (only in the IDE, not when actually compiling, of course):

clion warning about duplicate functions

 

2 – Side effects of thinking the test case is a duplicate function

Any method, variable, etc used in that test is marked as unused. Note how someOtherMethod is greyed out.

Sidebar is filled with these errors/warnings, which here are pretty harmless, but in more complex scenarios have all the drawbacks of false positives.

3 – Built in console does not support ANSI color codes.

This one is really a small issue, but it annoys me anyway.

I remember QtCreator used to have this exact same issue, but it got fixed a while back.

 

C++ is a complex language to parse, and CLion gets a lot of it right, most of the time.

I’m hoping to see this great IDE improve quickly in the next releases.

2 Comments

  1. Phil Nash
    September 3, 2015

    Nice write up. Thanks for trying Catch.

    The problem you’re seeing with the TEST_CASE macro has an open issue in the Catch tracker here: https://github.com/philsquared/Catch/issues/484 – which has links to a couple of relevant CLion issue reports. The first one has a few people weighing in to add voice to how problematic it is – so the more people report in there the more likely it will be dealt with sooner rather than later!

    Regards,

    [)o
    IhIL..

    Reply
  2. Björn Fahller
    September 3, 2015

    #1 will almost certainly be fixed when https://youtrack.jetbrains.com/issue/CPP-2801 is fixed. This’ll help with pretty much all C++ unit test frameworks and similar tools, not just Catch (I have a vested interest too with https://github.com/rollbear/trompeloeil mocking framework.)

    I presume that once #1 is done, #2 would go as well.

    This leaves #3.

    Reply

Leave a Reply