diff --git a/clang/unittests/AST/CommentTextTest.cpp b/clang/unittests/AST/CommentTextTest.cpp --- a/clang/unittests/AST/CommentTextTest.cpp +++ b/clang/unittests/AST/CommentTextTest.cpp @@ -124,4 +124,11 @@ // 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