forked from OSchip/llvm-project
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. llvm-svn: 332576
This commit is contained in:
parent
f5c0e6c285
commit
1b7bbb72f9
|
@ -58,49 +58,54 @@ For example,
|
||||||
this result.
|
this result.
|
||||||
That's about it.)";
|
That's about it.)";
|
||||||
// Two-slash comments.
|
// Two-slash comments.
|
||||||
EXPECT_EQ(ExpectedOutput, formatComment(
|
auto Formatted = formatComment(
|
||||||
R"cpp(
|
R"cpp(
|
||||||
// This function does this and that.
|
// This function does this and that.
|
||||||
// For example,
|
// For example,
|
||||||
// Runnning it in that case will give you
|
// Runnning it in that case will give you
|
||||||
// this result.
|
// this result.
|
||||||
// That's about it.)cpp"));
|
// That's about it.)cpp");
|
||||||
|
EXPECT_EQ(ExpectedOutput, Formatted);
|
||||||
|
|
||||||
// Three-slash comments.
|
// Three-slash comments.
|
||||||
EXPECT_EQ(ExpectedOutput, formatComment(
|
Formatted = formatComment(
|
||||||
R"cpp(
|
R"cpp(
|
||||||
/// This function does this and that.
|
/// This function does this and that.
|
||||||
/// For example,
|
/// For example,
|
||||||
/// Runnning it in that case will give you
|
/// Runnning it in that case will give you
|
||||||
/// this result.
|
/// this result.
|
||||||
/// That's about it.)cpp"));
|
/// That's about it.)cpp");
|
||||||
|
EXPECT_EQ(ExpectedOutput, Formatted);
|
||||||
|
|
||||||
// Block comments.
|
// Block comments.
|
||||||
EXPECT_EQ(ExpectedOutput, formatComment(
|
Formatted = formatComment(
|
||||||
R"cpp(
|
R"cpp(
|
||||||
/* This function does this and that.
|
/* This function does this and that.
|
||||||
* For example,
|
* For example,
|
||||||
* Runnning it in that case will give you
|
* Runnning it in that case will give you
|
||||||
* this result.
|
* this result.
|
||||||
* That's about it.*/)cpp"));
|
* That's about it.*/)cpp");
|
||||||
|
EXPECT_EQ(ExpectedOutput, Formatted);
|
||||||
|
|
||||||
// Doxygen-style block comments.
|
// Doxygen-style block comments.
|
||||||
EXPECT_EQ(ExpectedOutput, formatComment(
|
Formatted = formatComment(
|
||||||
R"cpp(
|
R"cpp(
|
||||||
/** This function does this and that.
|
/** This function does this and that.
|
||||||
* For example,
|
* For example,
|
||||||
* Runnning it in that case will give you
|
* Runnning it in that case will give you
|
||||||
* this result.
|
* this result.
|
||||||
* That's about it.*/)cpp"));
|
* That's about it.*/)cpp");
|
||||||
|
EXPECT_EQ(ExpectedOutput, Formatted);
|
||||||
|
|
||||||
// Weird indentation.
|
// Weird indentation.
|
||||||
EXPECT_EQ(ExpectedOutput, formatComment(
|
Formatted = formatComment(
|
||||||
R"cpp(
|
R"cpp(
|
||||||
// This function does this and that.
|
// This function does this and that.
|
||||||
// For example,
|
// For example,
|
||||||
// Runnning it in that case will give you
|
// Runnning it in that case will give you
|
||||||
// this result.
|
// this result.
|
||||||
// That's about it.)cpp"));
|
// That's about it.)cpp");
|
||||||
|
EXPECT_EQ(ExpectedOutput, Formatted);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,11 +116,12 @@ R"(\brief This is the brief part of the comment.
|
||||||
\param a something about a.
|
\param a something about a.
|
||||||
@param b something about b.)";
|
@param b something about b.)";
|
||||||
|
|
||||||
EXPECT_EQ(ExpectedOutput, formatComment(
|
auto Formatted = formatComment(
|
||||||
R"cpp(
|
R"cpp(
|
||||||
/// \brief This is the brief part of the comment.
|
/// \brief This is the brief part of the comment.
|
||||||
/// \param a something about a.
|
/// \param a something about a.
|
||||||
/// @param b something about b.)cpp"));
|
/// @param b something about b.)cpp");
|
||||||
|
EXPECT_EQ(ExpectedOutput, Formatted);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue