Use CHECK rather than REQUIRE in individual regex tests
Don't prevent the remaining CheckMatch() tests from running if one of them fails by using CHECK() rather than REQUIRE(). This is a bit awkward and we probably ought to use sections here instead, but this change is more minimal. This commit is best viewed ignoring whitespace-only changes.
This commit is contained in:
@@ -79,12 +79,21 @@ CheckMatch(const char* pattern,
|
|||||||
INFO( "Pattern: " << pattern << FlagStr(flags) << ", match: " << text );
|
INFO( "Pattern: " << pattern << FlagStr(flags) << ", match: " << text );
|
||||||
|
|
||||||
wxRegEx re(pattern, compileFlags);
|
wxRegEx re(pattern, compileFlags);
|
||||||
REQUIRE( re.IsValid() );
|
if ( !re.IsValid() )
|
||||||
|
{
|
||||||
|
FAIL("Regex compilation failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool ok = re.Matches(text, matchFlags);
|
if ( !re.Matches(text, matchFlags) )
|
||||||
|
{
|
||||||
|
CHECK( !expected );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (expected) {
|
CHECK( expected );
|
||||||
REQUIRE( ok );
|
if ( !expected )
|
||||||
|
return;
|
||||||
|
|
||||||
wxStringTokenizer tkz(wxString(expected, *wxConvCurrent),
|
wxStringTokenizer tkz(wxString(expected, *wxConvCurrent),
|
||||||
wxT("\t"), wxTOKEN_RET_EMPTY);
|
wxT("\t"), wxTOKEN_RET_EMPTY);
|
||||||
@@ -97,10 +106,6 @@ CheckMatch(const char* pattern,
|
|||||||
|
|
||||||
if ((flags & wxRE_NOSUB) == 0)
|
if ((flags & wxRE_NOSUB) == 0)
|
||||||
CHECK(re.GetMatchCount() == i);
|
CHECK(re.GetMatchCount() == i);
|
||||||
}
|
|
||||||
else {
|
|
||||||
CHECK( !ok );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("wxRegEx::Match", "[regex][match]")
|
TEST_CASE("wxRegEx::Match", "[regex][match]")
|
||||||
|
Reference in New Issue
Block a user