mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-20 10:24:12 +00:00
Add missing escape characters to the new Regex::escape() function
The old AddFixedStringToRegEx() it was based on got away with this for the longest time, but the problem became easy to spot after the cleanup in r197096. Also add a quick unit test to cover regex escaping. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197121 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -127,6 +127,11 @@ TEST_F(RegexTest, IsLiteralERE) {
|
||||
EXPECT_FALSE(Regex::isLiteralERE("abc{1,2}"));
|
||||
}
|
||||
|
||||
TEST_F(RegexTest, Escape) {
|
||||
EXPECT_EQ(Regex::escape("a[bc]"), "a\\[bc\\]");
|
||||
EXPECT_EQ(Regex::escape("abc{1\\,2}"), "abc\\{1\\\\,2\\}");
|
||||
}
|
||||
|
||||
TEST_F(RegexTest, IsValid) {
|
||||
std::string Error;
|
||||
EXPECT_FALSE(Regex("(foo").isValid(Error));
|
||||
|
Reference in New Issue
Block a user