aboutsummaryrefslogtreecommitdiff
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.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index ce68f91..d45babe 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -19615,6 +19615,25 @@ TEST_F(FormatTest, AlignConsecutiveAssignments) {
"};",
Alignment);
+ // Aligning lines should not mess up the comments. However, feel free to
+ // change the test if it turns out that comments inside the closure should not
+ // be aligned with those outside it.
+ verifyFormat("auto aaaaaaaaaaaaaaaaaaaaa = {}; //\n"
+ "auto b = [] { //\n"
+ " return; //\n"
+ "};",
+ Alignment);
+ verifyFormat("auto aaaaaaaaaaaaaaaaaaaaa = {}; //\n"
+ "auto b = [] { //\n"
+ " return aaaaaaaaaaaaaaaaaaaaa; //\n"
+ "};",
+ Alignment);
+ verifyFormat("auto aaaaaaaaaaaaaaa = {}; //\n"
+ "auto b = [] { //\n"
+ " return aaaaaaaaaaaaaaaaaaaaa; //\n"
+ "};",
+ Alignment);
+
verifyFormat("auto b = f(aaaaaaaaaaaaaaaaaaaaaaaaa,\n"
" ccc ? aaaaa : bbbbb,\n"
" dddddddddddddddddddddddddd);",