diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-01-16 11:43:46 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-01-16 11:43:46 +0000 |
commit | d881875b6c78386c4f0da911c1110f9ed1235c6a (patch) | |
tree | 9693a6db6acdb1436a2c0c3134b3f4d99e21b6de /unittests/Format/FormatTest.cpp | |
parent | a40548c36d91189506cb61fc66ab915fb91906e3 (diff) |
Clang Format: Handle missing semicolon
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172606 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 20 |
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) { |