Only one SUBCASE per line is executed #25

wichtounet opened this Issue Jun 14, 2016 · 1 comment


None yet

2 participants


I found an important difference with Catch: Only one SUBCASE per line is executed.

For instance, this test case:

TEST_CASE("lines") {
    SUBCASE("A"){ std::cout << "a";} SUBCASE("B"){ std::cout << "a"; }

Will only print "a" and not "aa". Catch (with SECTION) executes correctly both sections.

This makes a big difference when you are using SUBCASE in a macro. In which case, you'll have several SUBCASE per line once the preprocessor is done. I'm using this to create templated test case. This work well with Catch, but does not work with doctest.

This probably comes from the fact that pairs of files and lines are stored in subcasesPassed instead of triple of files, lines and names.

onqtam commented Jun 14, 2016

another thing I hadn't thought of :)

yes - that is the reason - I will add the name of the macro too - but even then It might fail when no name is given - but still it would be better than now. Thanks!

@onqtam onqtam added a commit that referenced this issue Aug 1, 2016
@onqtam fixed #25 3219654
@onqtam onqtam added a commit that closed this issue Sep 21, 2016
@onqtam fixed #25 6d64eb1
@onqtam onqtam closed this in 6d64eb1 Sep 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment