summaryrefslogtreecommitdiff
path: root/unittests
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
commitd2809eac2a3f384be5727e8effbf99810f7d5d66 (patch)
treed3372a5e80c2f63b0c8f1eabbf99c9a0bf4aea84 /unittests
parent1ee399bcf1a8c6e6e1fed1d645cdcadb04208a61 (diff)
downloadclang-d2809eac2a3f384be5727e8effbf99810f7d5d66.tar.gz
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; } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251824 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTestSelective.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestSelective.cpp b/unittests/Format/FormatTestSelective.cpp
index 9c4d1c3d2b..d53d1c0429 100644
--- a/unittests/Format/FormatTestSelective.cpp
+++ b/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"