You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying out https://github.com/nlohmann/json and wanted to test the exception mechanism it had.
My initial attempt was to use CHECK_THROWS but that was really difficult since nlohmann::json::out_of_range is not easy to construct. CHECK_THROWS_AS was what I was supposed to use and that worked fine.
Before figure that out I tried CHECK_THROWS with std::out_of_range and to my surprise that worked! The test also passed with std::bad_alloc.
I am not sure if this is to be expected since nlohmann::json::out_of_range is derived from std::exception.
What is the issue you have?
I was trying out https://github.com/nlohmann/json and wanted to test the exception mechanism it had.
My initial attempt was to use
CHECK_THROWS
but that was really difficult sincenlohmann::json::out_of_range
is not easy to construct.CHECK_THROWS_AS
was what I was supposed to use and that worked fine.Before figure that out I tried
CHECK_THROWS
withstd::out_of_range
and to my surprise that worked! The test also passed withstd::bad_alloc
.I am not sure if this is to be expected since
nlohmann::json::out_of_range
is derived from std::exception.Please describe the steps to reproduce the issue.
This
Code snippet
Can you provide a small but working code example?
Minimal example here: https://github.com/nandanvasudevan/cpp_scratch_pad/tree/json_parsing
What is the expected behavior?
I expect the above tests to fail.
catchorg/Catch2#2371
And what is the actual behavior instead?
The tests pass.
Which compiler and operating system are you using?
Which version of the library did you use?
develop
branchIf you experience a compilation error: can you compile and run the unit tests?
Compiles fine.
The text was updated successfully, but these errors were encountered: