We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
So I have this
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #include <cstddef> #include <cstdint> #include <gsl/gsl> #include <stdexcept> #include <doctest/doctest.h> class mac_addr final { private: static constexpr const std::size_t string_len = 12; public: mac_addr() noexcept { printf("A\n"); } explicit mac_addr(gsl::cstring_span<string_len> addr) { printf("B\n"); throw std::runtime_error("Tried to create a mac_addr from an invalid format"); } }; TEST_CASE("mac_addr works as expected") { SUBCASE("Throws if given bad input to construct from") { std::string invalid_character_mac("01020304050G"); REQUIRE_THROWS(mac_addr(invalid_character_mac)); } }
Failing with
src/mac_addr.cpp:34: FATAL ERROR: REQUIRE_THROWS( mac_addr(invalid_character_mac) ) did NOT throw at all!
since it does call the mac_addr default constructor. FWIW this works fine like this with Catch.
mac_addr
If I change
REQUIRE_THROWS(mac_addr(invalid_character_mac));
for
REQUIRE_THROWS(mac_addr(std::move(invalid_character_mac)));
Now the test passes.
The text was updated successfully, but these errors were encountered:
Doing this catchorg/Catch2@0dabd95 fixes the issue in doctest.
Sorry, something went wrong.
try what I've written in this comment and let me know if it works (dev branch - not in master yet): #216 (comment)
Yes, that works.
No branches or pull requests
So I have this
Failing with
src/mac_addr.cpp:34: FATAL ERROR: REQUIRE_THROWS( mac_addr(invalid_character_mac) ) did NOT throw at all!
since it does call the
mac_addr
default constructor.FWIW this works fine like this with Catch.
If I change
for
Now the test passes.
The text was updated successfully, but these errors were encountered: