catch_matchers_exception.cpp 750 B

123456789101112131415161718192021222324252627282930
  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. #include "catch_matchers_exception.hpp"
  8. namespace Catch {
  9. namespace Matchers {
  10. namespace Exception {
  11. bool ExceptionMessageMatcher::match(std::exception const& ex) const {
  12. return ex.what() == m_message;
  13. }
  14. std::string ExceptionMessageMatcher::describe() const {
  15. return "exception message matches \"" + m_message + "\"";
  16. }
  17. }
  18. Exception::ExceptionMessageMatcher Message(std::string const& message) {
  19. return Exception::ExceptionMessageMatcher(message);
  20. }
  21. // namespace Exception
  22. } // namespace Matchers
  23. } // namespace Catch