diff options
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 051deebc09..0840302754 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -594,6 +594,21 @@ TEST_F(FormatTest, UnderstandsSingleLineComments) { " aaaaaaaaaaaaaaaaaaaaaa); // 81 cols with this comment"); } +TEST_F(FormatTest, CanFormatCommentsLocally) { + EXPECT_EQ("int a; // comment\n" + "int b; // comment", + format("int a; // comment\n" + "int b; // comment", + 0, 0, getLLVMStyle())); + EXPECT_EQ("int a; // comment\n" + " // line 2\n" + "int b;", + format("int a; // comment\n" + " // line 2\n" + "int b;", + 28, 0, getLLVMStyle())); +} + TEST_F(FormatTest, RemovesTrailingWhitespaceOfComments) { EXPECT_EQ("// comment", format("// comment ")); EXPECT_EQ("int aaaaaaa, bbbbbbb; // comment", |