[libcxx] Add regex test cases from PR40904
authorLouis Dionne <ldionne@apple.com>
Thu, 30 May 2019 16:53:05 +0000 (16:53 +0000)
committerLouis Dionne <ldionne@apple.com>
Thu, 30 May 2019 16:53:05 +0000 (16:53 +0000)
llvm-svn: 362115

libcxx/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp

index d48d86e..5190357 100644 (file)
@@ -41,5 +41,15 @@ int main(int, char**) {
     assert(std::regex_match("X", std::regex("[^\\W]")));
     assert(std::regex_match("_", std::regex("[^\\W]")));
 
-  return 0;
+    // Those test cases are taken from PR40904
+    assert(std::regex_match("abZcd", std::regex("^ab[\\d\\D]cd")));
+    assert(std::regex_match("ab5cd", std::regex("^ab[\\d\\D]cd")));
+    assert(std::regex_match("abZcd", std::regex("^ab[\\D]cd")));
+    assert(std::regex_match("abZcd", std::regex("^ab\\Dcd")));
+    assert(std::regex_match("ab5cd", std::regex("^ab[\\d]cd")));
+    assert(std::regex_match("ab5cd", std::regex("^ab\\dcd")));
+    assert(!std::regex_match("abZcd", std::regex("^ab\\dcd")));
+    assert(!std::regex_match("ab5cd", std::regex("^ab\\Dcd")));
+
+    return 0;
 }