summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-11-08 23:31:14 +0000
committerDaniel Jasper <djasper@google.com>2013-11-08 23:31:14 +0000
commit0e93cdb0d02e7e078ef9187f688626673f02515d (patch)
tree2e81c7dfee734610ab4fc048b807e63a7fbb997e /clang/unittests/Format/FormatTest.cpp
parent9969d3e6e86236878fd4b4fab55473870290d709 (diff)
downloadbcm5719-llvm-0e93cdb0d02e7e078ef9187f688626673f02515d.tar.gz
bcm5719-llvm-0e93cdb0d02e7e078ef9187f688626673f02515d.zip
clang-format: Improve clang-format's detection about comment binding.
Before, existing code in the form of: int a; // this is a. // This is // b. int b; Got turned into: int a; // this is a. // This is // b. int b; llvm-svn: 194294
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 794fb1a64b0..e37f0cd4eb9 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -787,6 +787,26 @@ TEST_F(FormatTest, UnderstandsSingleLineComments) {
"// first\n"
" // at start\n"
"otherLine(); // comment"));
+ verifyFormat("f(); // comment\n"
+ "// first\n"
+ "// at start\n"
+ "otherLine();");
+ EXPECT_EQ("f(); // comment\n"
+ "// first\n"
+ "// at start\n"
+ "otherLine();",
+ format("f(); // comment\n"
+ "// first\n"
+ " // at start\n"
+ "otherLine();"));
+ EXPECT_EQ("f(); // comment\n"
+ " // first\n"
+ "// at start\n"
+ "otherLine();",
+ format("f(); // comment\n"
+ " // first\n"
+ "// at start\n"
+ "otherLine();"));
}
TEST_F(FormatTest, CanFormatCommentsLocally) {
OpenPOWER on IntegriCloud