This revision was automatically updated to reflect the committed changes. Closed by commit rGaa0d7179bbb3: [clang] NFC: test for undefined behaviour in RawComment::getFormattedText() (authored by DmitryPolukhin).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103722/new/ https://reviews.llvm.org/D103722 Files: clang/unittests/AST/CommentTextTest.cpp Index: clang/unittests/AST/CommentTextTest.cpp =================================================================== --- clang/unittests/AST/CommentTextTest.cpp +++ 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
Index: clang/unittests/AST/CommentTextTest.cpp =================================================================== --- clang/unittests/AST/CommentTextTest.cpp +++ 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
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits