[PATCH] D86926: FormatTest: Provide real line number in failure messages

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 07:02:11 PDT 2020


MyDeveloperDay added inline comments.


================
Comment at: clang/unittests/Format/FormatTest.cpp:69
 
-  void verifyFormat(llvm::StringRef Expected, llvm::StringRef Code,
-                    const FormatStyle &Style = getLLVMStyle()) {
+  void _verifyFormat(const char *File, int Line, llvm::StringRef Expected,
+                     llvm::StringRef Code,
----------------
Nit: I'm unsure of the convention for using _ at the front of functions, I'm not a major fan others might have other opinions


================
Comment at: clang/unittests/Format/FormatTest.cpp:72
+                     const FormatStyle &Style = getLLVMStyle()) {
+    ScopedTrace t(File, Line, ::testing::Message() << Code.str());
     EXPECT_EQ(Expected.str(), format(Expected, Style))
----------------
could you add an example as to what the output would look like? 

I think we could pass the File and line number to the EXPECT_EQ in the `<<` message


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86926/new/

https://reviews.llvm.org/D86926



More information about the cfe-commits mailing list