Add TESTUTILS_ASSERT_LIKE_FLAGS to pass regex flags
This commit is contained in:
parent
bf8e0db87f
commit
a7564b8dde
|
@ -262,12 +262,19 @@ template <typename T, Traits::DisableIf<std::is_integral<T>> * = nullptr> const
|
||||||
* \brief Asserts whether the specified \a string matches the specified \a regex.
|
* \brief Asserts whether the specified \a string matches the specified \a regex.
|
||||||
* \remarks Requires cppunit.
|
* \remarks Requires cppunit.
|
||||||
*/
|
*/
|
||||||
#define TESTUTILS_ASSERT_LIKE(message, expectedRegex, actualString) \
|
#define TESTUTILS_ASSERT_LIKE_FLAGS(message, expectedRegex, regexFlags, actualString) \
|
||||||
(CPPUNIT_NS::Asserter::failIf(!(std::regex_match(actualString, std::regex(expectedRegex))), \
|
(CPPUNIT_NS::Asserter::failIf(!(std::regex_match(actualString, std::regex(expectedRegex, regexFlags))), \
|
||||||
CPPUNIT_NS::Message( \
|
CPPUNIT_NS::Message( \
|
||||||
CppUtilities::argsToString('\"', actualString, "\"\n not like\n\"", expectedRegex, '\"'), "Expression: " #actualString, message), \
|
CppUtilities::argsToString('\"', actualString, "\"\n not like\n\"", expectedRegex, '\"'), "Expression: " #actualString, message), \
|
||||||
CPPUNIT_SOURCELINE()))
|
CPPUNIT_SOURCELINE()))
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Asserts whether the specified \a string matches the specified \a regex.
|
||||||
|
* \remarks Requires cppunit.
|
||||||
|
*/
|
||||||
|
#define TESTUTILS_ASSERT_LIKE(message, expectedRegex, actualString) \
|
||||||
|
TESTUTILS_ASSERT_LIKE_FLAGS(message, expectedRegex, std::regex::ECMAScript, actualString)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Allows printing pairs so key/values of maps/hashes can be asserted using CPPUNIT_ASSERT_EQUAL.
|
* \brief Allows printing pairs so key/values of maps/hashes can be asserted using CPPUNIT_ASSERT_EQUAL.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue