MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / assertRegex_

Method assertRegex_

test/testregex.cpp:47–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46#define assertRegex(...) assertRegex_(__FILE__, __LINE__, __VA_ARGS__)
47 std::shared_ptr<Regex> assertRegex_(const char* file, int line, std::string pattern, const std::string& exp_err = "") const {
48 std::string regex_err;
49 auto r = Regex::create(std::move(pattern), mEngine, regex_err);
50 if (exp_err.empty()) {
51 ASSERT_LOC(!!r.get(), file, line);
52 ASSERT_EQUALS_ENUM_LOC(mEngine, r->engine(), file, line);
53 }
54 else
55 ASSERT_LOC(!r.get(), file, line); // only not set if we encountered an error
56 ASSERT_EQUALS_LOC(exp_err, regex_err, file, line);
57 return r;
58 }
59
60 void match() const {
61 const auto r = assertRegex("begin.*end");

Callers

nothing calls this directly

Calls 3

engineMethod · 0.80
emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected