diff options
author | Manuel Klimek <klimek@google.com> | 2013-01-07 08:54:53 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2013-01-07 08:54:53 +0000 |
commit | 6cf581436e9e59a18f6a362027a69eaaa9b67597 (patch) | |
tree | 822343254b5e40cafa896e5f5ca7e7e4ca2ce8a6 /unittests/Format/FormatTest.cpp | |
parent | 9541938d4e3b9cbafdf0e1a28900c535b82767a4 (diff) |
Fix layouting of single-line-comments preceded by an escaped newline.
Previously, we'd format
int i;\
// comment
as
int i; // comment
The problem is that the escaped newline is part of the next token, and
thus the raw token text of the comment doesn't start with "//".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171713 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 3e672ae5a3..27ca53c1ea 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -290,6 +290,9 @@ TEST_F(FormatTest, UnderstandsSingleLineComments) { verifyFormat( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =\n" " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; // Trailing comment"); + + EXPECT_EQ("int i; // single line trailing comment", + format("int i;\\\n// single line trailing comment")); } TEST_F(FormatTest, UnderstandsMultiLineComments) { |