summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestSelective.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-11-02 20:02:49 +0000
committerDaniel Jasper <djasper@google.com>2015-11-02 20:02:49 +0000
commitf83834feb15845bb85cefa892efcad7ec3d07e2c (patch)
treead726f1b3ccd1db05710bc0998bfeefc242de9cc /clang/unittests/Format/FormatTestSelective.cpp
parent2297a9142e13f84cc7102ed722922ba21511d7b6 (diff)
downloadbcm5719-llvm-f83834feb15845bb85cefa892efcad7ec3d07e2c.tar.gz
bcm5719-llvm-f83834feb15845bb85cefa892efcad7ec3d07e2c.zip
clang-format: Simplify and improve stop condition for formatting
unaffected lines with incorrect initial indent. Starting from: namespace { int i; // There shouldn't be indentation here. int j; // <- call clang-format on this line. } Before: namespace { int i; int j; } After: namespace { int i; int j; } llvm-svn: 251824
Diffstat (limited to 'clang/unittests/Format/FormatTestSelective.cpp')
-rw-r--r--clang/unittests/Format/FormatTestSelective.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestSelective.cpp b/clang/unittests/Format/FormatTestSelective.cpp
index 9c4d1c3d2b0..d53d1c04292 100644
--- a/clang/unittests/Format/FormatTestSelective.cpp
+++ b/clang/unittests/Format/FormatTestSelective.cpp
@@ -273,6 +273,27 @@ TEST_F(FormatTestSelective, IndividualStatementsOfNestedBlocks) {
0, 0));
}
+TEST_F(FormatTestSelective, WrongIndent) {
+ EXPECT_EQ("namespace {\n"
+ "int i;\n"
+ "int j;\n"
+ "}",
+ format("namespace {\n"
+ " int i;\n" // Format here.
+ " int j;\n"
+ "}",
+ 15, 0));
+ EXPECT_EQ("namespace {\n"
+ " int i;\n"
+ " int j;\n"
+ "}",
+ format("namespace {\n"
+ " int i;\n"
+ " int j;\n" // Format here.
+ "}",
+ 24, 0));
+}
+
TEST_F(FormatTestSelective, AlwaysFormatsEntireMacroDefinitions) {
Style.AlignEscapedNewlinesLeft = true;
EXPECT_EQ("int i;\n"
OpenPOWER on IntegriCloud