diff options
author | Daniel Jasper <djasper@google.com> | 2013-02-14 09:58:41 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-02-14 09:58:41 +0000 |
commit | c78c6b35d398b4c9414e7c5c7e413e28a66c8c5f (patch) | |
tree | 4757f448fd63b2e78128cbb5a11942786f956368 /unittests/Format/FormatTest.cpp | |
parent | c5cfa490a1fa4eb1a3a17803c6125b42abd73455 (diff) |
Remove the trailing whitespace of formatted lines.
So far, clang-format has always assumed the whitespace belonging to the
subsequent token. This has the negative side-effect that when
clang-format formats a line, it does not remove its trailing whitespace,
as it belongs to the next token.
Thus, this patch fixes most of llvm.org/PR15062.
We are not zapping a file's trailing whitespace so far, as this does not
belong to any token we see during formatting. We need to fix this in a
subsequent patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175152 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index e99aad7a8c..232cd6b98a 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -162,6 +162,10 @@ TEST_F(FormatTest, OnlyGeneratesNecessaryReplacements) { EXPECT_EQ(0, ReplacementCount); } +TEST_F(FormatTest, RemovesTrailingWhitespaceOfFormattedLine) { + EXPECT_EQ("int a;\nint b;", format("int a; \nint b;", 0, 0, getLLVMStyle())); +} + //===----------------------------------------------------------------------===// // Tests for control statements. //===----------------------------------------------------------------------===// |