[clang-tools-extra] 61559d0 - [clangd] Squash GCC error with StringRef + gtest MatchesRegex()

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Tue May 19 04:58:32 PDT 2020


Author: Sam McCall
Date: 2020-05-19T13:58:23+02:00
New Revision: 61559d045868e3980deca6cf5d30ad8816951960

URL: https://github.com/llvm/llvm-project/commit/61559d045868e3980deca6cf5d30ad8816951960
DIFF: https://github.com/llvm/llvm-project/commit/61559d045868e3980deca6cf5d30ad8816951960.diff

LOG: [clangd] Squash GCC error with StringRef + gtest MatchesRegex()

Added: 
    

Modified: 
    clang-tools-extra/clangd/unittests/support/TraceTests.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/unittests/support/TraceTests.cpp b/clang-tools-extra/clangd/unittests/support/TraceTests.cpp
index cee43f73f211..953002b69a46 100644
--- a/clang-tools-extra/clangd/unittests/support/TraceTests.cpp
+++ b/clang-tools-extra/clangd/unittests/support/TraceTests.cpp
@@ -170,12 +170,16 @@ TEST_F(CSVMetricsTracerTest, RecordsValues) {
   Counter.record(1, "");
   Dist.record(2, "y");
 
-  EXPECT_THAT(
-      outputLines(),
+  auto Lines = outputLines();
+  ASSERT_THAT(
+      Lines,
       ElementsAre("Kind,Metric,Label,Value,Timestamp",
-                  MatchesRegex(R"(d,dist,x,1\.000000e\+00,[0-9]+\.[0-9]{6})"),
+                  StartsWith("d,dist,x,1.000000e+00,"),
                   StartsWith("c,cnt,,1.000000e+00,"),
                   StartsWith("d,dist,y,2.000000e+00,"), ""));
+  // Also check timestamp format.
+  EXPECT_THAT(Lines[1].str(),
+              MatchesRegex(R"(d,dist,x,1\.000000e\+00,[0-9]+\.[0-9]{6})"));
 }
 
 TEST_F(CSVMetricsTracerTest, Escaping) {


        


More information about the cfe-commits mailing list