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

Test not failing when exception is thrown (in v1.9.0) #885

Closed
p-brz opened this issue Apr 9, 2017 · 3 comments
Closed

Test not failing when exception is thrown (in v1.9.0) #885

p-brz opened this issue Apr 9, 2017 · 3 comments

Comments

@p-brz
Copy link

p-brz commented Apr 9, 2017

Description

I was doing some TDD with new Catch version (1.9.0).
When expecting that tests failed, they were passing.
Reducing the problem to minimum, discovered that the
(expected) exception was been thrown. But the tests was passing.

I also tested with release 1.8.2 and it worked fine.

Steps to reproduce

This minimal code can reproduce the error (i hope):

#define CATCH_CONFIG_MAIN
#include "catch.hpp"

TEST_CASE("should fail"){
    throw std::exception();
}

Extra information

  • Catch version: v1.9.0
  • Operating System: Linux
  • Compiler+version: gcc 5.4.0
@p-brz p-brz changed the title Test not failing when exception is thrown (in 1.9.0) Test not failing when exception is thrown (in v1.9.0) Apr 9, 2017
@horenmar
Copy link
Member

horenmar commented Apr 9, 2017

Well, that was an embarrassing mistake. The underlying cause was that to prevent double reporting of exceptions when using CATCH_CONFIG_FAST_COMPILE, unexpected exceptions had to be ignored under certain conditions. Due to a mistake on my part, when CATCH_CONFIG_FAST_COMPILE was not defined, all exceptions were ignored...

I am going to tag this with a revisit, because I need to take a look at why this didn't show up in Catch's self-test, but 1.9.1 is out and it should be fixed.

@horenmar
Copy link
Member

horenmar commented Apr 9, 2017

I figured out why it didn't show up -- Phil approved the differences caused by the bug by mistake in 250f0ee...

@horenmar horenmar removed the Revisit label Apr 9, 2017
@philsquared
Copy link
Collaborator

Yup - sorry about that. Thought it was something else.

Minoru added a commit to akrennmair/newsbeuter that referenced this issue Apr 9, 2017
This fixes a nasty bug where Catch *ignored* unexpected exceptions:
catchorg/Catch2#885 Didn't affect us
because we haven't written any new tests since upgrade to 1.9.0.
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

3 participants