[clang] [clang-format] Separate License text and include blocks (PR #77918)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 11:47:37 PST 2024


================
@@ -26846,6 +26846,26 @@ TEST_F(FormatTest, BreakAdjacentStringLiterals) {
   Style.BreakAdjacentStringLiterals = false;
   verifyFormat(Code, Style);
 }
+
+TEST_F(FormatTest, EmptyLinesAfterInclude) {
+  auto Style = getLLVMStyle();
+  Style.EmptyLinesAfterIncludes = 2;
+  Style.MaxEmptyLinesToKeep = 2;
+  verifyFormat("#include <string>\n\n\n"
+               "class Test {};",
+               Style);
+
+  Style.EmptyLinesAfterIncludes = 1;
+  verifyFormat("#include <string>\n\n"
+               "class Test {};",
+               Style);
+
+  Style.EmptyLinesAfterIncludes = 2;
+  Style.MaxEmptyLinesToKeep = 1;
+  verifyFormat("#include <string>\n\n"
+               "class Test {};",
+               Style);
+}
----------------
HazardyKnusperkeks wrote:

Please add tests with multiple includes and in conjunction with include sorting/grouping.

https://github.com/llvm/llvm-project/pull/77918


More information about the cfe-commits mailing list