summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/unittests/Support/RegexTest.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
committerpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
commit53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch)
tree7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/unittests/Support/RegexTest.cpp
parentIn preparation of compiling our kernels with -ffreestanding, explicitly map (diff)
downloadwireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz
wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/unittests/Support/RegexTest.cpp')
-rw-r--r--gnu/llvm/unittests/Support/RegexTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/gnu/llvm/unittests/Support/RegexTest.cpp b/gnu/llvm/unittests/Support/RegexTest.cpp
index c045c49bc3d..5e3ce39f005 100644
--- a/gnu/llvm/unittests/Support/RegexTest.cpp
+++ b/gnu/llvm/unittests/Support/RegexTest.cpp
@@ -151,6 +151,24 @@ TEST_F(RegexTest, MoveAssign) {
Regex r2("abc");
r2 = std::move(r1);
EXPECT_TRUE(r2.match("916"));
+ std::string Error;
+ EXPECT_FALSE(r1.isValid(Error));
+}
+
+TEST_F(RegexTest, NoArgConstructor) {
+ std::string Error;
+ Regex r1;
+ EXPECT_FALSE(r1.isValid(Error));
+ EXPECT_EQ("invalid regular expression", Error);
+ r1 = Regex("abc");
+ EXPECT_TRUE(r1.isValid(Error));
+}
+
+TEST_F(RegexTest, MatchInvalid) {
+ Regex r1;
+ std::string Error;
+ EXPECT_FALSE(r1.isValid(Error));
+ EXPECT_FALSE(r1.match("X"));
}
}