diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-06-11 16:01:49 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-06-11 16:01:49 +0000 |
commit | 555efc36d08b07e65e2aba65c91fcaec63834c29 (patch) | |
tree | 4084d1b79103bd7851ece8261c34c59ec040d62e /clang/unittests/Format/FormatTest.cpp | |
parent | 447d2d12f0d4a41feeb88341bddbaa79c36a5103 (diff) | |
download | bcm5719-llvm-555efc36d08b07e65e2aba65c91fcaec63834c29.tar.gz bcm5719-llvm-555efc36d08b07e65e2aba65c91fcaec63834c29.zip |
Insert a space at the start of a line comment in case it starts with an alphanumeric character.
Summary:
"//Test" becomes "// Test". This change is aimed to improve code
readability and conformance to certain coding styles. If a comment starts with a
non-alphanumeric character, the space isn't added, e.g. "//-*-c++-*-" stays
unchanged.
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D949
llvm-svn: 183750
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 1b7f699ef30..3a4cd8d3244 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -860,10 +860,15 @@ TEST_F(FormatTest, SplitsLongCxxComments) { EXPECT_EQ("// Don't_touch_leading_whitespace", format("// Don't_touch_leading_whitespace", getLLVMStyleWithColumns(20))); - EXPECT_EQ( - "//Don't add leading\n" - "//whitespace", - format("//Don't add leading whitespace", getLLVMStyleWithColumns(20))); + EXPECT_EQ("// Add leading\n" + "// whitespace", + format("//Add leading whitespace", getLLVMStyleWithColumns(20))); + EXPECT_EQ("// whitespace", format("//whitespace", getLLVMStyle())); + EXPECT_EQ("// Even if it makes the line exceed the column\n" + "// limit", + format("//Even if it makes the line exceed the column limit", + getLLVMStyleWithColumns(51))); + EXPECT_EQ("//--But not here", format("//--But not here", getLLVMStyle())); EXPECT_EQ("// A comment before\n" "// a macro\n" "// definition\n" |