diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-08-08 17:32:45 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-08-08 17:32:45 +0000 |
commit | 783a0387c5eef62ff50950aa3e977b2652a3c3a5 (patch) | |
tree | 4aba83eec46eeced2a36f5ddc8db20983918277b /unittests | |
parent | 014773626d2678868adf696ac58c44d2b2980fa8 (diff) | |
download | llvm-783a0387c5eef62ff50950aa3e977b2652a3c3a5.tar.gz llvm-783a0387c5eef62ff50950aa3e977b2652a3c3a5.tar.bz2 llvm-783a0387c5eef62ff50950aa3e977b2652a3c3a5.tar.xz |
Fix off-by-one error in Regex::isValid
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187992 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Support/RegexTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/Support/RegexTest.cpp b/unittests/Support/RegexTest.cpp index 02869b3ed4..7b977f7446 100644 --- a/unittests/Support/RegexTest.cpp +++ b/unittests/Support/RegexTest.cpp @@ -127,4 +127,12 @@ TEST_F(RegexTest, IsLiteralERE) { EXPECT_FALSE(Regex::isLiteralERE("abc{1,2}")); } +TEST_F(RegexTest, IsValid) { + std::string Error; + EXPECT_FALSE(Regex("(foo").isValid(Error)); + EXPECT_EQ("parentheses not balanced", Error); + EXPECT_FALSE(Regex("a[b-").isValid(Error)); + EXPECT_EQ("invalid character range", Error); +} + } |