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.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index ca022a4bbe..4d860c1f65 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1213,7 +1213,25 @@ TEST_F(FormatTest, HandlesIncludeDirectives) {
//===----------------------------------------------------------------------===//
TEST_F(FormatTest, IncorrectCodeTrailingStuff) {
- verifyFormat("void f() { return } 42");
+ verifyFormat("void f() { return }\n42");
+ verifyFormat("void f() {\n"
+ " if (0)\n"
+ " return\n"
+ "}\n"
+ "42");
+}
+
+TEST_F(FormatTest, IncorrectCodeMissingSemicolon) {
+ EXPECT_EQ("void f() { return }", format("void f ( ) { return }"));
+ EXPECT_EQ("void f() {\n"
+ " if (a)\n"
+ " return\n"
+ "}", format("void f ( ) { if ( a ) return }"));
+ EXPECT_EQ("namespace N { void f() }", format("namespace N { void f() }"));
+ EXPECT_EQ("namespace N {\n"
+ "void f() {}\n"
+ "void g()\n"
+ "}", format("namespace N { void f( ) { } void g( ) }"));
}
TEST_F(FormatTest, IndentationWithinColumnLimitNotPossible) {