[clang] NFC: test for undefined behaviour in RawComment::getFormattedText()

This diff adds testcase for the issue fixed in https://reviews.llvm.org/D77468
but regression test was not added in the diff. On Clang 9 it caused
crash in cland during code completion.

Test Plan: check-clang-unit

Differential Revision: https://reviews.llvm.org/D103722
This commit is contained in:
Dmitry Polukhin 2021-06-04 14:41:53 -07:00
parent 1da2c7d25c
commit aa0d7179bb
1 changed files with 7 additions and 0 deletions

View File

@ -124,4 +124,11 @@ R"cpp(
// clang-format on // clang-format on
} }
TEST_F(CommentTextTest, EmptyFormattedText) {
// Test that empty formatted text doesn't cause crash.
const char *ExpectedOutput = "";
auto Formatted = formatComment("//!<");
EXPECT_EQ(ExpectedOutput, Formatted);
}
} // namespace clang } // namespace clang