diff options
author | Daniel Jasper <djasper@google.com> | 2013-10-18 10:38:14 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-10-18 10:38:14 +0000 |
commit | 6633ab8ad95b9cb8ecfbfb9249cc22462fddec5c (patch) | |
tree | abbf7ea325da35c8edd7d59a952a69ad126e27e7 /clang/unittests/Format/FormatTest.cpp | |
parent | 314e58fdcca09287a1b85076210894ce91de061b (diff) | |
download | bcm5719-llvm-6633ab8ad95b9cb8ecfbfb9249cc22462fddec5c.tar.gz bcm5719-llvm-6633ab8ad95b9cb8ecfbfb9249cc22462fddec5c.zip |
clang-format: Make continuation indent width configurable.
Patch by Kim Gräsman. Thank you!
llvm-svn: 192964
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 5a8b5d6f52b..1e898d8f721 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -6495,6 +6495,7 @@ TEST_F(FormatTest, ParsesConfiguration) { CHECK_PARSE("SpacesBeforeTrailingComments: 1234", SpacesBeforeTrailingComments, 1234u); CHECK_PARSE("IndentWidth: 32", IndentWidth, 32u); + CHECK_PARSE("ContinuationIndentWidth: 11", ContinuationIndentWidth, 11u); Style.Standard = FormatStyle::LS_Auto; CHECK_PARSE("Standard: Cpp03", Standard, FormatStyle::LS_Cpp03); @@ -6876,5 +6877,23 @@ TEST_F(FormatTest, MunchSemicolonAfterBlocks) { "};"); } +TEST_F(FormatTest, ConfigurableContinuationIndentWidth) { + FormatStyle TwoIndent = getLLVMStyleWithColumns(15); + TwoIndent.ContinuationIndentWidth = 2; + + EXPECT_EQ("int i =\n" + " longFunction(\n" + " arg);", + format("int i = longFunction(arg);", TwoIndent)); + + FormatStyle SixIndent = getLLVMStyleWithColumns(20); + SixIndent.ContinuationIndentWidth = 6; + + EXPECT_EQ("int i =\n" + " longFunction(\n" + " arg);", + format("int i = longFunction(arg);", SixIndent)); +} + } // end namespace tooling } // end namespace clang |