aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-03-20 14:31:47 +0000
committerDaniel Jasper <djasper@google.com>2013-03-20 14:31:47 +0000
commit83a90e5e6525acdb8cc4778ed102cd3952559f15 (patch)
tree53bf1913a455eb106888dd29c6e996308476ad05 /unittests
parent64f092865c01c72ecb9e380432e241f3af55c249 (diff)
downloadclang-83a90e5e6525acdb8cc4778ed102cd3952559f15.tar.gz
Do not consider comments when adjusting to local indent style.
Before (when only reformatting "int b"): int a; // comment // comment int b; After: int a; // comment // comment int b; This also fixes llvm.org/PR15433. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177524 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 7f9cecb031..40f09539e7 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -3279,6 +3279,13 @@ TEST_F(FormatTest, ReformatRegionAdjustsIndent) {
format("void f() {}\n"
"void g() {}",
13, 0, getLLVMStyle()));
+ EXPECT_EQ("int a; // comment\n"
+ " // line 2\n"
+ "int b;",
+ format("int a; // comment\n"
+ " // line 2\n"
+ " int b;",
+ 35, 0, getLLVMStyle()));
}
TEST_F(FormatTest, BreakStringLiterals) {