Don't mix flags from different enums in wxRegEx unit test
Pass compilation and matching flags using separate parameters instead of passing them as a single int and then separating them inside the function. This is a bit cleaner and also avoids warning about using deprecated enum operations when using C++20. (cherry picked from commit 4b0fa10a290d899278007f4743df3f811df506a1)
This commit is contained in:
parent
0413f02f40
commit
8e50da6875
@ -71,12 +71,12 @@ static void
|
||||
CheckMatch(const char* pattern,
|
||||
const char* text,
|
||||
const char* expected = NULL,
|
||||
int flags = wxRE_DEFAULT)
|
||||
int compileFlags = wxRE_DEFAULT,
|
||||
int matchFlags = 0)
|
||||
{
|
||||
int compileFlags = flags & ~(wxRE_NOTBOL | wxRE_NOTEOL);
|
||||
int matchFlags = flags & (wxRE_NOTBOL | wxRE_NOTEOL);
|
||||
|
||||
INFO( "Pattern: " << pattern << FlagStr(flags) << ", match: " << text );
|
||||
INFO( "Pattern: "
|
||||
<< pattern << FlagStr(static_cast<int>(compileFlags) | matchFlags)
|
||||
<< ", match: " << text );
|
||||
|
||||
wxRegEx re(pattern, compileFlags);
|
||||
if ( !re.IsValid() )
|
||||
@ -104,7 +104,7 @@ CheckMatch(const char* pattern,
|
||||
CHECK( re.GetMatch(text, i) == tkz.GetNextToken() );
|
||||
}
|
||||
|
||||
if ((flags & wxRE_NOSUB) == 0)
|
||||
if ((compileFlags & wxRE_NOSUB) == 0)
|
||||
CHECK(re.GetMatchCount() == i);
|
||||
}
|
||||
|
||||
@ -124,8 +124,8 @@ TEST_CASE("wxRegEx::Match", "[regex][match]")
|
||||
CheckMatch("^[A-Z].*$", "AA\nbb\nCC", "AA\nbb\nCC");
|
||||
CheckMatch("^[A-Z].*$", "AA\nbb\nCC", "AA", wxRE_NEWLINE);
|
||||
CheckMatch("^[a-z].*$", "AA\nbb\nCC", "bb", wxRE_NEWLINE);
|
||||
CheckMatch("^[A-Z].*$", "AA\nbb\nCC", "CC", wxRE_NEWLINE | wxRE_NOTBOL);
|
||||
CheckMatch("^[A-Z].*$", "AA\nbb\nCC", NULL, wxRE_NEWLINE | wxRE_NOTBOL | wxRE_NOTEOL);
|
||||
CheckMatch("^[A-Z].*$", "AA\nbb\nCC", "CC", wxRE_NEWLINE, wxRE_NOTBOL);
|
||||
CheckMatch("^[A-Z].*$", "AA\nbb\nCC", NULL, wxRE_NEWLINE, wxRE_NOTBOL | wxRE_NOTEOL);
|
||||
CheckMatch("([[:alpha:]]+) ([[:alpha:]]+) ([[:digit:]]+).* ([[:digit:]]+)$",
|
||||
"Fri Jul 13 18:37:52 CEST 2001",
|
||||
"Fri Jul 13 18:37:52 CEST 2001\tFri\tJul\t13\t2001");
|
||||
|
Loading…
Reference in New Issue
Block a user