summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 067a259b2ce..122b367a223 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -970,8 +970,8 @@ TEST_F(FormatTest, DontSplitLineCommentsWithEscapedNewlines) {
}
TEST_F(FormatTest, PriorityOfCommentBreaking) {
- EXPECT_EQ("if (xxx == yyy && // aaaaaaaaaaaa\n"
- " // bbbbbbbbb\n"
+ EXPECT_EQ("if (xxx ==\n"
+ " yyy && // aaaaaaaaaaaa bbbbbbbbb\n"
" zzz)\n"
" q();",
format("if (xxx == yyy && // aaaaaaaaaaaa bbbbbbbbb\n"
@@ -5392,10 +5392,10 @@ TEST_F(FormatTest, BreakStringLiteralsBeforeUnbreakableTokenSequence) {
" \"f\");",
format("someFunction1234567890(\"aaabbbcccdddeeefff\");",
getLLVMStyleWithColumns(24)));
- EXPECT_EQ("someFunction(\n"
- " \"aaabbbcc \"\n"
- " \"dddeeefff\");",
- format("someFunction(\"aaabbbcc dddeeefff\");",
+ EXPECT_EQ("someFunction(\"aaabbbcc \"\n"
+ " \"ddde \"\n"
+ " \"efff\");",
+ format("someFunction(\"aaabbbcc ddde efff\");",
getLLVMStyleWithColumns(25)));
EXPECT_EQ("someFunction(\"aaabbbccc \"\n"
" \"ddeeefff\");",
@@ -5413,6 +5413,12 @@ TEST_F(FormatTest, BreakStringLiteralsBeforeUnbreakableTokenSequence) {
" int i;",
format("#define A string s = \"1234567890\"; int i;",
getLLVMStyleWithColumns(20)));
+ // FIXME: Put additional penalties on breaking at non-whitespace locations.
+ EXPECT_EQ("someFunction(\"aaabbbcc \"\n"
+ " \"dddeeeff\"\n"
+ " \"f\");",
+ format("someFunction(\"aaabbbcc dddeeefff\");",
+ getLLVMStyleWithColumns(25)));
}
TEST_F(FormatTest, DoNotBreakStringLiteralsInEscapeSequence) {
OpenPOWER on IntegriCloud