Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only one SUBCASE per line is executed #25

Closed
wichtounet opened this issue Jun 14, 2016 · 1 comment
Closed

Only one SUBCASE per line is executed #25

wichtounet opened this issue Jun 14, 2016 · 1 comment

Comments

@wichtounet
Copy link

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
Copy link
Member

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 added a commit that referenced this issue Aug 1, 2016
@onqtam onqtam closed this as completed in 6d64eb1 Sep 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants