diff options
author | Daniel Jasper <djasper@google.com> | 2013-09-25 15:15:02 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-09-25 15:15:02 +0000 |
commit | 9b4de85e2f47a01974f451d21fed0276ff912e32 (patch) | |
tree | 34d1088d6e6edff3e88d3bc994bc35deb9627515 /unittests | |
parent | 74cd65e8dc60fe9e6c397b3393da7303debbc971 (diff) | |
download | clang-9b4de85e2f47a01974f451d21fed0276ff912e32.tar.gz |
clang-format: Option to removing the space before assignment operators.
Patch contributed by Aaron Wishnick. Thank you!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191375 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index a1136825b1..0175413a50 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -5996,6 +5996,18 @@ TEST_F(FormatTest, ConfigurableSpacesInParentheses) { "}", Spaces); } +TEST_F(FormatTest, ConfigurableSpaceBeforeAssignmentOperators) { + verifyFormat("int a = 5;"); + verifyFormat("a += 42;"); + verifyFormat("a or_eq 8;"); + + FormatStyle Spaces = getLLVMStyle(); + Spaces.SpaceBeforeAssignmentOperators = false; + verifyFormat("int a= 5;", Spaces); + verifyFormat("a+= 42;", Spaces); + verifyFormat("a or_eq 8;", Spaces); +} + TEST_F(FormatTest, LinuxBraceBreaking) { FormatStyle BreakBeforeBrace = getLLVMStyle(); BreakBeforeBrace.BreakBeforeBraces = FormatStyle::BS_Linux; @@ -6237,6 +6249,7 @@ TEST_F(FormatTest, ParsesConfiguration) { CHECK_PARSE_BOOL(SpaceInEmptyParentheses); CHECK_PARSE_BOOL(SpacesInCStyleCastParentheses); CHECK_PARSE_BOOL(SpaceAfterControlStatementKeyword); + CHECK_PARSE_BOOL(SpaceBeforeAssignmentOperators); CHECK_PARSE("AccessModifierOffset: -1234", AccessModifierOffset, -1234); CHECK_PARSE("ConstructorInitializerIndentWidth: 1234", |