File: catch_capture_matchers.cpp

package info (click to toggle)
log4cplus 2.0.5-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 10,560 kB
  • sloc: cpp: 46,669; sh: 10,310; ansic: 1,845; python: 1,114; perl: 258; makefile: 214; xml: 85; objc: 59
file content (24 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 *  Created by Phil on 9/8/2017.
 *  Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
 *
 *  Distributed under the Boost Software License, Version 1.0. (See accompanying
 *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 */
#include "catch_capture_matchers.h"
#include "catch_interfaces_registry_hub.h"

namespace Catch {

    using StringMatcher = Matchers::Impl::MatcherBase<std::string>;

    // This is the general overload that takes a any string matcher
    // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers
    // the Equals matcher (so the header does not mention matchers)
    void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString  ) {
        std::string exceptionMessage = Catch::translateActiveException();
        MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
        handler.handleExpr( expr );
    }

} // namespace Catch