aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index fbde283e95..5b5f483c62 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -3734,5 +3734,19 @@ TEST_F(FormatTest, DoNotBreakStringLiteralsInEscapeSequence) {
format("R\"(\\x\\x00)\"\n", getLLVMStyleWithColumns(7)));
}
+TEST_F(FormatTest, DoNotCreateUnreasonableUnwrappedLines) {
+ verifyFormat("void f() {\n"
+ " return g() {}\n"
+ " void h() {}");
+ verifyFormat("if (foo)\n"
+ " return { forgot_closing_brace();\n"
+ "test();");
+ verifyFormat("int a[] = { void forgot_closing_brace()\n"
+ "{\n"
+ " f();\n"
+ " g();\n"
+ "}");
+}
+
} // end namespace tooling
} // end namespace clang