summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-08-08 17:32:45 +0000
committerAlexey Samsonov <samsonov@google.com>2013-08-08 17:32:45 +0000
commit783a0387c5eef62ff50950aa3e977b2652a3c3a5 (patch)
tree4aba83eec46eeced2a36f5ddc8db20983918277b /unittests
parent014773626d2678868adf696ac58c44d2b2980fa8 (diff)
downloadllvm-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.cpp8
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);
+}
+
}