summaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-12-14 20:47:11 +0000
committerAlexander Kornienko <alexfh@google.com>2014-12-14 20:47:11 +0000
commit3200b33d5c5d1ff8971b1d9aa8be2d23f96d8a0a (patch)
tree5d28a023b5ebbc28574f98fa8e0939682a91a4f5 /unittests
parentbc5dfed59cdd9741ee7f80427cb144e46b79452c (diff)
Don't break single-line raw string literals.
Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6636 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224223 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTest.cpp29
1 files changed, 8 insertions, 21 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 2b4553cefc..743f501b0d 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -7385,22 +7385,14 @@ TEST_F(FormatTest, BreaksWideAndNSStringLiterals) {
format("@\"NSString literal\";", getGoogleStyleWithColumns(19)));
}
-TEST_F(FormatTest, BreaksRawStringLiterals) {
- EXPECT_EQ("R\"x(raw )x\"\n"
- "R\"x(literal)x\";",
- format("R\"x(raw literal)x\";", getGoogleStyleWithColumns(15)));
- EXPECT_EQ("uR\"x(raw )x\"\n"
- "uR\"x(literal)x\";",
- format("uR\"x(raw literal)x\";", getGoogleStyleWithColumns(16)));
- EXPECT_EQ("u8R\"x(raw )x\"\n"
- "u8R\"x(literal)x\";",
- format("u8R\"x(raw literal)x\";", getGoogleStyleWithColumns(17)));
- EXPECT_EQ("LR\"x(raw )x\"\n"
- "LR\"x(literal)x\";",
- format("LR\"x(raw literal)x\";", getGoogleStyleWithColumns(16)));
- EXPECT_EQ("UR\"x(raw )x\"\n"
- "UR\"x(literal)x\";",
- format("UR\"x(raw literal)x\";", getGoogleStyleWithColumns(16)));
+TEST_F(FormatTest, DoesNotBreakRawStringLiterals) {
+ FormatStyle Style = getGoogleStyleWithColumns(15);
+ EXPECT_EQ("R\"x(raw literal)x\";", format("R\"x(raw literal)x\";", Style));
+ EXPECT_EQ("uR\"x(raw literal)x\";", format("uR\"x(raw literal)x\";", Style));
+ EXPECT_EQ("LR\"x(raw literal)x\";", format("LR\"x(raw literal)x\";", Style));
+ EXPECT_EQ("UR\"x(raw literal)x\";", format("UR\"x(raw literal)x\";", Style));
+ EXPECT_EQ("u8R\"x(raw literal)x\";",
+ format("u8R\"x(raw literal)x\";", Style));
}
TEST_F(FormatTest, BreaksStringLiteralsWithin_TMacro) {
@@ -7589,11 +7581,6 @@ TEST_F(FormatTest, DoNotBreakStringLiteralsInEscapeSequence) {
"\"00000000\"\n"
"\"1\"",
format("\"test\\000000000001\"", getLLVMStyleWithColumns(10)));
- // FIXME: We probably don't need to care about escape sequences in raw
- // literals.
- EXPECT_EQ("R\"(\\x)\"\n"
- "R\"(\\x00)\"\n",
- format("R\"(\\x\\x00)\"\n", getGoogleStyleWithColumns(7)));
}
TEST_F(FormatTest, DoNotCreateUnreasonableUnwrappedLines) {