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

Compact reporter does not handle [!shouldfail] properly #878

Closed
horenmar opened this issue Apr 3, 2017 · 4 comments · Fixed by #2554
Closed

Compact reporter does not handle [!shouldfail] properly #878

horenmar opened this issue Apr 3, 2017 · 4 comments · Fixed by #2554
Labels

Comments

@horenmar
Copy link
Member

horenmar commented Apr 3, 2017

Description

Compact reporter does not handle the [!shouldfail] tag properly. Given this code (from #876):

bool thisThrows() {
    throw std::runtime_error("Boom");
}

TEST_CASE("#748 - captures with unexpected exceptions", "[!shouldfail]") {
    int answer = 42;
    CAPTURE(answer);
    // the message should be printed on the first two sections but not on the third
    SECTION("outside assertions") {
        thisThrows();
    }
    SECTION("inside REQUIRE_NOTHROW") {
        REQUIRE_NOTHROW(thisThrows());
    }
    SECTION("inside REQUIRE_THROWS") {
        REQUIRE_THROWS(thisThrows());
    }
}

compact reporter's output is

<snip>
Passed all 0 test cases with 1 assertion.

which, while kind-of correct, is surprising. Standard console reporter's output looks like this:

<snip>
test cases: 1 | 1 failed as expected
assertions: 3 | 1 passed | 2 failed as expected

which is much clearer about what happened and should be in some way replicated by the compact reporter.

Extra information

  • Catch version: v1.8.2
@psalz
Copy link
Contributor

psalz commented Oct 17, 2022

I thought a bit about how this might look like but any attempts to have all the information on a single line ended up being quite messy (and it will only get worse with #2360). How about we just copy the output format from the console reporter exactly, save for the "totals divider"?

@horenmar
Copy link
Member Author

Yeah, that seems fine.

@psalz
Copy link
Contributor

psalz commented Oct 18, 2022

Okay, stylistically, would you prefer (1) a common base class for console and compact reporter, (2) free functions used by both or (3) code duplication?

@horenmar
Copy link
Member Author

  1. or 3), depending on how annoying the signature would be. I don't think the console and compact reporters should have a shared base class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants