Correctly indent with tabs when whitespace starts from the column not divisible by TabWidth.
Summary:
The width of the first inserted tab character depends on the initial
column, so we need to handle the first tab in a special manner.
Reviewers: klimek, djasper
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1763
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191497 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index d54c042..c5fa70c 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -5760,6 +5760,20 @@
Tab.IndentWidth = 8;
Tab.UseTab = true;
Tab.AlignEscapedNewlinesLeft = true;
+
+ EXPECT_EQ("if (aaaaaaaa && // q\n"
+ " bb)\t\t// w\n"
+ "\t;",
+ format("if (aaaaaaaa &&// q\n"
+ "bb)// w\n"
+ ";",
+ Tab));
+ EXPECT_EQ("if (aaa && bbb) // w\n"
+ "\t;",
+ format("if(aaa&&bbb)// w\n"
+ ";",
+ Tab));
+
verifyFormat("class X {\n"
"\tvoid f() {\n"
"\t\tsomeFunction(parameter1,\n"
@@ -5843,6 +5857,7 @@
" \t \t in multiple lines\t\n"
" \t */",
Tab));
+
Tab.UseTab = false;
EXPECT_EQ("/*\n"
" a\t\tcomment\n"