snitch-org / snitch

Lightweight C++20 testing framework.
Boost Software License 1.0
252 stars 7 forks source link

Two different errors when REQUIRE_THROWS_AS doesn't throw #143

Closed vid512 closed 8 months ago

vid512 commented 8 months ago

This code:

#define SNITCH_IMPLEMENTATION
#include "snitch_all.hpp"

#include <exception>

void func() {}

TEST_CASE("blah") {
    REQUIRE_THROWS_AS(func(), std::runtime_error);
}

outputs:

starting a with snitch v1.2.3.f605e7e
==========================================
failed: running test case "blah"
          at a.cpp:14
          std::runtime_error expected but no exception thrown
failed: running test case "blah"
          at a.cpp:14
          std::runtime_error expected but other unknown exception thrown
==========================================
error: all tests failed (1 out of 1 test cases, 2 assertions, 1.976000e-04 seconds)
cschreib commented 8 months ago

Huho, looks like a bug. I'll take a look.

cschreib commented 8 months ago

Confirmed. A PR with a fix is in progress.

cschreib commented 8 months ago

This is fixed on the latest main branch. Please feel free to reopen if you still experience a problem with this. Thanks for reporting the issue!