瀏覽代碼

[libcxx] Add regex test cases from PR40904

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@362115 91177308-0d34-0410-b5e6-96231b3b80d8
Louis Dionne 6 年之前
父節點
當前提交
98c565c88c
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp

+ 11 - 1
test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp

@@ -41,5 +41,15 @@ int main(int, char**) {
     assert(std::regex_match("X", std::regex("[^\\W]")));
     assert(std::regex_match("X", std::regex("[^\\W]")));
     assert(std::regex_match("_", 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;
 }
 }