[clang-tools-extra] r310586 - [clang-tidy] Add a test.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 10 05:38:46 PDT 2017


Author: alexfh
Date: Thu Aug 10 05:38:46 2017
New Revision: 310586

URL: http://llvm.org/viewvc/llvm-project?rev=310586&view=rev
Log:
[clang-tidy] Add a test.

Modified:
    clang-tools-extra/trunk/unittests/clang-tidy/ReadabilityModuleTest.cpp

Modified: clang-tools-extra/trunk/unittests/clang-tidy/ReadabilityModuleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/ReadabilityModuleTest.cpp?rev=310586&r1=310585&r2=310586&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-tidy/ReadabilityModuleTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/ReadabilityModuleTest.cpp Thu Aug 10 05:38:46 2017
@@ -487,11 +487,17 @@ TEST(BracesAroundStatementsCheckTest, Im
   ClangTidyOptions Opts;
   Opts.CheckOptions["test-check-0.ShortStatementLines"] = "1";
 
-  EXPECT_NO_CHANGES_WITH_OPTS(BracesAroundStatementsCheck, Opts,
-                              "const char *f() {\n"
+  StringRef Input = "const char *f() {\n"
                               "  if (true) return \"\";\n"
                               "  return \"abc\";\n"
-                              "}\n");
+                              "}\n";
+  EXPECT_NO_CHANGES_WITH_OPTS(BracesAroundStatementsCheck, Opts, Input);
+  EXPECT_EQ("const char *f() {\n"
+            "  if (true) { return \"\";\n"
+            "}\n"
+            "  return \"abc\";\n"
+            "}\n",
+            runCheckOnCode<BracesAroundStatementsCheck>(Input));
 }
 
 } // namespace test




More information about the cfe-commits mailing list