diff options
| author | Clement Courbet <courbet@google.com> | 2018-05-17 06:46:15 +0000 |
|---|---|---|
| committer | Clement Courbet <courbet@google.com> | 2018-05-17 06:46:15 +0000 |
| commit | e831748eaaa33bd543f5474ecd4cb76cbdc46b29 (patch) | |
| tree | 389a58dafe8cb0416af9d7c0638e17772a835fb5 /unittests/AST/CommentTextTest.cpp | |
| parent | 08472b552c81730b0e88b23fd30a7aacfa42fd34 (diff) | |
| download | clang-e831748eaaa33bd543f5474ecd4cb76cbdc46b29.tar.gz | |
Fix rL332458: [AST] Added a helper to extract a user-friendly text of a comment.
Older gcc versions do not support raw string literals within macros.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332576 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/AST/CommentTextTest.cpp')
| -rw-r--r-- | unittests/AST/CommentTextTest.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/unittests/AST/CommentTextTest.cpp b/unittests/AST/CommentTextTest.cpp index 05003b599e..04475f1c10 100644 --- a/unittests/AST/CommentTextTest.cpp +++ b/unittests/AST/CommentTextTest.cpp @@ -58,49 +58,54 @@ For example, this result. That's about it.)"; // Two-slash comments. - EXPECT_EQ(ExpectedOutput, formatComment( + auto Formatted = formatComment( R"cpp( // This function does this and that. // For example, // Runnning it in that case will give you // this result. -// That's about it.)cpp")); +// That's about it.)cpp"); + EXPECT_EQ(ExpectedOutput, Formatted); // Three-slash comments. - EXPECT_EQ(ExpectedOutput, formatComment( + Formatted = formatComment( R"cpp( /// This function does this and that. /// For example, /// Runnning it in that case will give you /// this result. -/// That's about it.)cpp")); +/// That's about it.)cpp"); + EXPECT_EQ(ExpectedOutput, Formatted); // Block comments. - EXPECT_EQ(ExpectedOutput, formatComment( + Formatted = formatComment( R"cpp( /* This function does this and that. * For example, * Runnning it in that case will give you * this result. - * That's about it.*/)cpp")); + * That's about it.*/)cpp"); + EXPECT_EQ(ExpectedOutput, Formatted); // Doxygen-style block comments. - EXPECT_EQ(ExpectedOutput, formatComment( + Formatted = formatComment( R"cpp( /** This function does this and that. * For example, * Runnning it in that case will give you * this result. - * That's about it.*/)cpp")); + * That's about it.*/)cpp"); + EXPECT_EQ(ExpectedOutput, Formatted); // Weird indentation. - EXPECT_EQ(ExpectedOutput, formatComment( + Formatted = formatComment( R"cpp( // This function does this and that. // For example, // Runnning it in that case will give you // this result. - // That's about it.)cpp")); + // That's about it.)cpp"); + EXPECT_EQ(ExpectedOutput, Formatted); // clang-format on } @@ -111,11 +116,12 @@ R"(\brief This is the brief part of the comment. \param a something about a. @param b something about b.)"; - EXPECT_EQ(ExpectedOutput, formatComment( + auto Formatted = formatComment( R"cpp( /// \brief This is the brief part of the comment. /// \param a something about a. -/// @param b something about b.)cpp")); +/// @param b something about b.)cpp"); + EXPECT_EQ(ExpectedOutput, Formatted); // clang-format on } |
