catch_matchers_exception.hpp 932 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Created by Martin Hořeňovský on 13/10/2019.
  3. *
  4. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #ifndef TWOBLUECUBES_CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED
  8. #define TWOBLUECUBES_CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED
  9. #include "catch_matchers.h"
  10. namespace Catch {
  11. namespace Matchers {
  12. namespace Exception {
  13. class ExceptionMessageMatcher : public MatcherBase<std::exception> {
  14. std::string m_message;
  15. public:
  16. ExceptionMessageMatcher(std::string const& message):
  17. m_message(message)
  18. {}
  19. bool match(std::exception const& ex) const override;
  20. std::string describe() const override;
  21. };
  22. } // namespace Exception
  23. Exception::ExceptionMessageMatcher Message(std::string const& message);
  24. } // namespace Matchers
  25. } // namespace Catch
  26. #endif // TWOBLUECUBES_CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED