diff options
author | Manuel Klimek <klimek@google.com> | 2013-01-18 14:46:43 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2013-01-18 14:46:43 +0000 |
commit | da08761bb2cf2e2ee330770571d9b7e650343d26 (patch) | |
tree | a41cf3d388d56021fbfb53edef6917047a9c0195 /clang/unittests/Format/FormatTest.cpp | |
parent | 40ac112c91eda5d74402d89ae4c03ac8491b364c (diff) | |
download | bcm5719-llvm-da08761bb2cf2e2ee330770571d9b7e650343d26.tar.gz bcm5719-llvm-da08761bb2cf2e2ee330770571d9b7e650343d26.zip |
Fixes issues around pulling in the next line in simple if statements.
llvm-svn: 172822
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 6b77868776a..1434f32e2f3 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -1542,20 +1542,23 @@ TEST_F(FormatTest, MergeHandlingInTheFaceOfPreprocessorDirectives) { AllowsMergedIf.AllowShortIfStatementsOnASingleLine = true; verifyFormat("void f() { f(); }\n#error E", AllowsMergedIf); verifyFormat("if (true) return 42;\n#error E", AllowsMergedIf); - - // FIXME: - // verifyFormat("if (true)\n#error E\n return 42;", AllowsMergedIf); + verifyFormat("if (true)\n#error E\n return 42;", AllowsMergedIf); + EXPECT_EQ("if (true) return 42;", + format("if (true)\nreturn 42;", AllowsMergedIf)); + FormatStyle ShortMergedIf = AllowsMergedIf; + ShortMergedIf.ColumnLimit = 25; + verifyFormat("#define A \\\n" + " if (true) return 42;", ShortMergedIf); + verifyFormat("#define A \\\n" + " f(); \\\n" + " if (true)\n" + "#define B", ShortMergedIf); + verifyFormat("#define A \\\n" + " f(); \\\n" + " if (true)\n" + "g();", ShortMergedIf); } -// FIXME: This breaks the order of the unwrapped lines: -// TEST_F(FormatTest, OrderUnwrappedLines) { -// verifyFormat("{\n" -// " bool a; //\n" -// "#error {\n" -// " int a;\n" -// "}"); -// } - //===----------------------------------------------------------------------===// // Objective-C tests. //===----------------------------------------------------------------------===// |