summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index d9f56e38f84..6cc9d1979fa 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -11852,6 +11852,40 @@ TEST_F(FormatTest, AlignTrailingComments) {
" // line 3\n"
" b);",
getLLVMStyleWithColumns(40)));
+
+ // Align newly broken trailing comments.
+ EXPECT_EQ("int ab; // line\n"
+ "int a; // long\n"
+ " // long\n",
+ format("int ab; // line\n"
+ "int a; // long long\n",
+ getLLVMStyleWithColumns(15)));
+ EXPECT_EQ("int ab; // line\n"
+ "int a; // long\n"
+ " // long\n"
+ " // long",
+ format("int ab; // line\n"
+ "int a; // long long\n"
+ " // long",
+ getLLVMStyleWithColumns(15)));
+ EXPECT_EQ("int ab; // line\n"
+ "int a; // long\n"
+ " // long\n"
+ "pt c; // long",
+ format("int ab; // line\n"
+ "int a; // long long\n"
+ "pt c; // long",
+ getLLVMStyleWithColumns(15)));
+ EXPECT_EQ("int ab; // line\n"
+ "int a; // long\n"
+ " // long\n"
+ "\n"
+ "// long",
+ format("int ab; // line\n"
+ "int a; // long long\n"
+ "\n"
+ "// long",
+ getLLVMStyleWithColumns(15)));
}
} // end namespace
} // end namespace format
OpenPOWER on IntegriCloud