Tests: Add test for case-insensitive matching
This commit is contained in:
parent
74d76528d6
commit
9a9e7f03f2
Notes:
sideshowbarker
2024-07-18 12:11:18 +09:00
Author: https://github.com/sin-ack Commit: https://github.com/SerenityOS/serenity/commit/9a9e7f03f29 Pull-request: https://github.com/SerenityOS/serenity/pull/8086 Reviewed-by: https://github.com/MaxWipfli Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/gunnarbeutner
1 changed files with 10 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "LibRegex/RegexMatcher.h"
|
||||
#include <LibTest/TestCase.h> // import first, to prevent warning of VERIFY* redefinition
|
||||
|
||||
#include <AK/StringBuilder.h>
|
||||
|
@ -595,3 +596,12 @@ TEST_CASE(replace)
|
|||
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
Reference in a new issue