banditcpp / bandit

Human-friendly unit testing for C++11
https://banditcpp.github.io/bandit/
Other
259 stars 37 forks source link

Does not Catch Exceptions (Mac, GCC 13.2.0) #172

Open SSoelvsten opened 4 months ago

SSoelvsten commented 4 months ago

After I updated the compiler versions for Mac on my research project to also include GCC v.13.2.0, the unit test executable terminates early due to an (expected) exception:

terminate called after throwing an instance of 'std::invalid_argument'
  what():  Adiar requires at least 128 MiB of memory

11155 Abort trap: 6           ./test/test-adiar --reporter=info --colorizer=light

The unit test in question is a simple test for this very exception:

    it("throws exception when given '0' memory",
       [&]() { AssertThrows(invalid_argument, adiar_init(0)); });

As far as I know, even if the AssertThrows wasn't there, the it(...) ought to have caught the exception?

Additional Observations

My personal machine runs Fedora with GCC 3.2.1 . Here, there are no issues. Earlier versions of GCC and all current versions of Clang work as expected on Mac. So, my best guess is it is a bug in this particular compiler version.

So, most likely, this issue is a wontfix. But, as long as this versions of GCC is the default with Homebrew, it might be good to have it on record as an issue.

SSoelvsten commented 3 months ago

This pull request on my research project instead shows this is because the header-only branch is out of date.