diff options
author | Alexander Kornienko <alexfh@google.com> | 2012-12-05 15:06:06 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2012-12-05 15:06:06 +0000 |
commit | 2e97cfc78743fcaa988e3c45f7af1002063f780c (patch) | |
tree | c76ab7eec9dc86d9b98c0a0ccca7f853248720f1 /unittests/Format/FormatTest.cpp | |
parent | 33182dd0f7d5b5e913b1957c2cb6dc04942efd46 (diff) |
Clang-format: parse for and while loops
Summary: Adds support for formatting for and while loops.
Reviewers: djasper, klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D174
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169387 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index c9860d595c..05a6d334f5 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -81,11 +81,26 @@ TEST_F(FormatTest, FormatsNestedBlockStatements) { TEST_F(FormatTest, FormatsForLoop) { verifyFormat( "for (int VeryVeryLongLoopVariable = 0; VeryVeryLongLoopVariable < 10;\n" - " ++VeryVeryLongLoopVariable);"); + " ++VeryVeryLongLoopVariable)\n" + " ;"); + verifyFormat("for (;;)\n" + " f();"); + verifyFormat("for (;;) {\n" + "}"); + verifyFormat("for (;;) {\n" + " f();\n" + "}"); } TEST_F(FormatTest, FormatsWhileLoop) { verifyFormat("while (true) {\n}"); + verifyFormat("while (true)\n" + " f();"); + verifyFormat("while () {\n" + "}"); + verifyFormat("while () {\n" + " f();\n" + "}"); } TEST_F(FormatTest, FormatsNestedCall) { |