diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-05 17:47:59 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-05 17:47:59 +0000 |
commit | aa80e61b0d79ddf9593f6217063574d0c66c3099 (patch) | |
tree | b67392ed36975afce5e1c12553d94b9274dc9321 /unittests | |
parent | 2a37c7e9e6059f7b5cfffce8917a49c0810d5a18 (diff) | |
download | external_llvm-aa80e61b0d79ddf9593f6217063574d0c66c3099.zip external_llvm-aa80e61b0d79ddf9593f6217063574d0c66c3099.tar.gz external_llvm-aa80e61b0d79ddf9593f6217063574d0c66c3099.tar.bz2 |
Introduce Regex::isLiteralERE function.
This will be used to implement an optimisation for literal entries
in special case lists.
Differential Revision: http://llvm-reviews.chandlerc.com/D1278
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187731 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Support/RegexTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/unittests/Support/RegexTest.cpp b/unittests/Support/RegexTest.cpp index 3577d10..02869b3 100644 --- a/unittests/Support/RegexTest.cpp +++ b/unittests/Support/RegexTest.cpp @@ -112,4 +112,19 @@ TEST_F(RegexTest, Substitution) { EXPECT_EQ(Error, "invalid backreference string '100'"); } +TEST_F(RegexTest, IsLiteralERE) { + EXPECT_TRUE(Regex::isLiteralERE("abc")); + EXPECT_FALSE(Regex::isLiteralERE("a(bc)")); + EXPECT_FALSE(Regex::isLiteralERE("^abc")); + EXPECT_FALSE(Regex::isLiteralERE("abc$")); + EXPECT_FALSE(Regex::isLiteralERE("a|bc")); + EXPECT_FALSE(Regex::isLiteralERE("abc*")); + EXPECT_FALSE(Regex::isLiteralERE("abc+")); + EXPECT_FALSE(Regex::isLiteralERE("abc?")); + EXPECT_FALSE(Regex::isLiteralERE("abc.")); + EXPECT_FALSE(Regex::isLiteralERE("a[bc]")); + EXPECT_FALSE(Regex::isLiteralERE("abc\\1")); + EXPECT_FALSE(Regex::isLiteralERE("abc{1,2}")); +} + } |