diff options
author | Daniel Jasper <djasper@google.com> | 2013-10-29 14:52:02 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-10-29 14:52:02 +0000 |
commit | dd978ae0e118ebd99d18df518cf8d03ea115af07 (patch) | |
tree | 7bbb6b836d37e8325a015cb0579ec94df4792bae /clang/unittests/Format/FormatTest.cpp | |
parent | f34ac3ed2c9badee39b3efc72d4c34f922cf3b39 (diff) | |
download | bcm5719-llvm-dd978ae0e118ebd99d18df518cf8d03ea115af07.tar.gz bcm5719-llvm-dd978ae0e118ebd99d18df518cf8d03ea115af07.zip |
clang-format: Option to control spacing in template argument lists.
Same as SpacesInParentheses, this option allows adding a space inside
the '<' and '>' of a template parameter list.
Patch by Christopher Olsen.
This fixes llvm.org/PR17301.
llvm-svn: 193614
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 83035f72bc9..991763cdf7f 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -6592,6 +6592,7 @@ TEST_F(FormatTest, ParsesConfiguration) { CHECK_PARSE_BOOL(Cpp11BracedListStyle); CHECK_PARSE_BOOL(IndentFunctionDeclarationAfterType); CHECK_PARSE_BOOL(SpacesInParentheses); + CHECK_PARSE_BOOL(SpacesInAngles); CHECK_PARSE_BOOL(SpaceInEmptyParentheses); CHECK_PARSE_BOOL(SpacesInCStyleCastParentheses); CHECK_PARSE_BOOL(SpaceAfterControlStatementKeyword); @@ -7010,5 +7011,30 @@ TEST_F(FormatTest, ConfigurableContinuationIndentWidth) { format("int i = longFunction(arg);", SixIndent)); } +TEST_F(FormatTest, SpacesInAngles) { + FormatStyle Spaces = getLLVMStyle(); + Spaces.SpacesInAngles = true; + + verifyFormat("static_cast< int >(arg);", Spaces); + verifyFormat("template < typename T0, typename T1 > void f() {}", Spaces); + verifyFormat("f< int, float >();", Spaces); + verifyFormat("template <> g() {}", Spaces); + verifyFormat("template < std::vector< int > > f() {}", Spaces); + + Spaces.Standard = FormatStyle::LS_Cpp03; + Spaces.SpacesInAngles = true; + verifyFormat("A< A< int > >();", Spaces); + + Spaces.SpacesInAngles = false; + verifyFormat("A<A<int> >();", Spaces); + + Spaces.Standard = FormatStyle::LS_Cpp11; + Spaces.SpacesInAngles = true; + verifyFormat("A< A< int > >();", Spaces); + + Spaces.SpacesInAngles = false; + verifyFormat("A<A<int>>();", Spaces); +} + } // end namespace tooling } // end namespace clang |