mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +00:00
Tests: Add test for case-insensitive matching
This commit is contained in:
parent
74d76528d6
commit
9a9e7f03f2
1 changed files with 10 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "LibRegex/RegexMatcher.h"
|
||||||
#include <LibTest/TestCase.h> // import first, to prevent warning of VERIFY* redefinition
|
#include <LibTest/TestCase.h> // import first, to prevent warning of VERIFY* redefinition
|
||||||
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
|
@ -595,3 +596,12 @@ TEST_CASE(replace)
|
||||||
EXPECT_EQ(re.replace(test.subject, test.replacement), test.expected);
|
EXPECT_EQ(re.replace(test.subject, test.replacement), test.expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE(case_insensitive_match)
|
||||||
|
{
|
||||||
|
Regex<PosixExtended> re("cd", PosixFlags::Insensitive | PosixFlags::Global);
|
||||||
|
auto result = re.match("AEKFCD");
|
||||||
|
|
||||||
|
EXPECT_EQ(result.success, true);
|
||||||
|
EXPECT_EQ(result.matches.at(0).column, 4ul);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue