aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-04-02 13:04:06 +0000
committerAlexander Kornienko <alexfh@google.com>2013-04-02 13:04:06 +0000
commitf52d52790708132cc1a3b5c3aef1bed17eb6ff13 (patch)
treeff27a4a827f6f6c7dbee5b3f9620712dfcb1ddfb /unittests
parent3d11708c491a96198ebfee49079ae458ed90eaf8 (diff)
Alternative handling of comments adjacent to preprocessor directives.
Summary: Store comments in ScopedLineState Reviewers: klimek, djasper Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D609 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 62ce4c33ac..df93fbd05a 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -708,6 +708,15 @@ TEST_F(FormatTest, SplitsLongCxxComments) {
getLLVMStyleWithColumns(20)));
}
+TEST_F(FormatTest, ParsesCommentsAdjacentToPPDirectives) {
+ EXPECT_EQ("namespace {}\n// Test\n#define A",
+ format("namespace {}\n // Test\n#define A"));
+ EXPECT_EQ("namespace {}\n/* Test */\n#define A",
+ format("namespace {}\n /* Test */\n#define A"));
+ EXPECT_EQ("namespace {}\n/* Test */ #define A",
+ format("namespace {}\n /* Test */ #define A"));
+}
+
TEST_F(FormatTest, SplitsLongLinesInComments) {
EXPECT_EQ("/* This is a long\n"
" * comment that\n"