catch_capture_matchers.cpp 1.0 KB

123456789101112131415161718192021222324
  1. /*
  2. * Created by Phil on 9/8/2017.
  3. * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
  4. *
  5. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. */
  8. #include "catch_capture_matchers.h"
  9. #include "catch_interfaces_registry_hub.h"
  10. namespace Catch {
  11. using StringMatcher = Matchers::Impl::MatcherBase<std::string>;
  12. // This is the general overload that takes a any string matcher
  13. // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers
  14. // the Equals matcher (so the header does not mention matchers)
  15. void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ) {
  16. std::string exceptionMessage = Catch::translateActiveException();
  17. MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
  18. handler.handleExpr( expr );
  19. }
  20. } // namespace Catch