41 std::string_view pattern,
42 std::string_view reason = {},
43 std::optional<std::source_location> location = std::source_location::current()
45 auto regex = std::regex(std::string(pattern));
46 if (detail::regex_matches(actual, regex)) {
47 auto actual_string = detail::to_string(actual);
48 auto expected_string = std::format(
"/{}/", pattern);
49 auto message = std::format(
"Expected <{}> not to match <{}>", actual_string, expected_string);
50 throw assertion_error(message, reason, std::move(actual_string), std::move(expected_string), location);
69 std::regex
const& regex,
70 std::string_view reason = {},
71 std::optional<std::source_location> location = std::source_location::current()
73 if (detail::regex_matches(actual, regex)) {
74 auto actual_string = detail::to_string(actual);
75 auto message = std::format(
"Expected <{}> not to match regex", actual_string);
77 throw assertion_error(message, reason, std::move(actual_string),
"regex", location);
void assert_not_match(T const &actual, std::string_view pattern, std::string_view reason={}, std::optional< std::source_location > location=std::source_location::current())
Asserts that the argument does not match the given pattern.
Definition assert_not_match.hpp:39