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.
This commit is contained in:
parent
8a5d9295b7
commit
4b0fa10a29
1 changed files with 8 additions and 8 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue