summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-10-14 00:46:35 +0000
committerAlexander Kornienko <alexfh@google.com>2013-10-14 00:46:35 +0000
commite2e0387f3e48d6fde871cb388f7322b4239e7cc9 (patch)
tree1b481feacb0b257f1138e6563c257b525ee55246 /clang/unittests/Format/FormatTest.cpp
parentc4a5a3f65d6b2c850f66f3496b1892a0673e4b1e (diff)
downloadbcm5719-llvm-e2e0387f3e48d6fde871cb388f7322b4239e7cc9.tar.gz
bcm5719-llvm-e2e0387f3e48d6fde871cb388f7322b4239e7cc9.zip
Keep track of indentation levels in static initializers for correct indentation with tabs.
Summary: Store IndentationLevel in ParentState and use it instead of the Line::Level when indening. Also fixed incorrect indentation level calculation in formatFirstToken. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D1797 llvm-svn: 192563
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index afe9c8b1cc2..5a8b5d6f52b 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -5968,6 +5968,21 @@ TEST_F(FormatTest, ConfigurableUseOfTab) {
Tab));
Tab.UseTab = FormatStyle::UT_ForIndentation;
+ verifyFormat("T t[] = {\n"
+ "\taaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+ "\taaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+ "\taaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+ "\taaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+ "\taaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+ "\taaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
+ "};",
+ Tab);
+ verifyFormat("enum A {\n"
+ "\ta1,\n"
+ "\ta2,\n"
+ "\ta3\n"
+ "};",
+ Tab);
EXPECT_EQ("if (aaaaaaaa && // q\n"
" bb) // w\n"
"\t;",
OpenPOWER on IntegriCloud