Details.tests.cpp 848 B

1234567891011121314151617181920212223
  1. /*
  2. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. */
  5. #include "catch.hpp"
  6. #if defined(_MSC_VER)
  7. #pragma warning(push)
  8. #pragma warning(disable:4702) // unreachable code in the macro expansions
  9. #endif
  10. TEST_CASE("Check that our error handling macros throw the right exceptions", "[!throws][internals][approvals]") {
  11. REQUIRE_THROWS_AS(CATCH_INTERNAL_ERROR(""), std::logic_error);
  12. REQUIRE_THROWS_AS(CATCH_ERROR(""), std::domain_error);
  13. REQUIRE_THROWS_AS(CATCH_RUNTIME_ERROR(""), std::runtime_error);
  14. REQUIRE_THROWS_AS([](){CATCH_ENFORCE(false, "");}(), std::domain_error);
  15. REQUIRE_NOTHROW([](){CATCH_ENFORCE(true, "");}());
  16. }
  17. #if defined(_MSC_VER)
  18. #pragma warning(pop) // unreachable code in the macro expansions
  19. #endif