| 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"); |