summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2012-12-05 15:06:06 +0000
committerAlexander Kornienko <alexfh@google.com>2012-12-05 15:06:06 +0000
commit37d6c94e28653f37611d268acca79644c6ecde9d (patch)
tree4c4b6e6e8063f1117ec19d04a1f732ea4794e313 /clang/unittests/Format
parentaa1c920db85e7ac07d09b80eedc66bae7e358f26 (diff)
downloadbcm5719-llvm-37d6c94e28653f37611d268acca79644c6ecde9d.tar.gz
bcm5719-llvm-37d6c94e28653f37611d268acca79644c6ecde9d.zip
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 llvm-svn: 169387
Diffstat (limited to 'clang/unittests/Format')
-rw-r--r--clang/unittests/Format/FormatTest.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index c9860d595ce..05a6d334f55 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud