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

If the last section fails, the test is re-run once more #1389

Closed
nikola-benes opened this issue Sep 20, 2018 · 3 comments
Closed

If the last section fails, the test is re-run once more #1389

nikola-benes opened this issue Sep 20, 2018 · 3 comments

Comments

@nikola-benes
Copy link

Description

It seems that if the last SECTION inside a TEST_CASE fails (i.e. contains a false assertion), the TEST_CASE is run once more, this time bypassing all the sections. Is this expected behaviour?

Steps to reproduce

TEST_CASE("X") {
    // this part is executed twice
    SECTION("A") {
        REQUIRE(false);
    }
    // this part is executed once
}

Extra information

  • Catch version: v2.4.0
  • Operating System: Arch Linux
  • Compiler+version: clang-6.0 with libstdc++
@nikola-benes nikola-benes changed the title If last section fails, the test is re-run once more If the last section fails, the test is re-run once more Sep 20, 2018
@philsquared
Copy link
Collaborator

Unfortunately, yes. The reason is that Catch/2 is discovering sections as it runs them. If the last section fails it doesn't know if there are any more after it - so needs to run again to see.

horenmar added a commit that referenced this issue Sep 21, 2018
This fixes some wording that implies C++98 standard, updates
the recommended solution to looped SECTION macros and mentioned
the "last section failed, test needs to be rerun" problem.

Related to #1367
Related to #1384
Related to #1389
@horenmar
Copy link
Member

Yeah, this is not really possible to fix.

@JoeyGrajciar
Copy link
Contributor

Closing based on last comment

@horenmar horenmar removed the Resolved - pending review Issue waiting for feedback from the original author label Oct 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants