[clang-tools-extra] [clang-doc] Add Markdown AST node type definitions (PR #205609)
Paul Kirth via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 24 21:09:02 PDT 2026
================
@@ -0,0 +1,56 @@
+#include "support/Markdown.h"
+#include "llvm/Support/Casting.h"
+#include "gtest/gtest.h"
+
+using namespace clang::doc::markdown;
+using namespace llvm;
+
+namespace {
+
+TEST(MarkdownNodeTest, TextNode) {
+ TextNode N("hello");
+ EXPECT_EQ(N.Kind, NodeKind::NK_Text);
+ EXPECT_EQ(N.Text, "hello");
+}
+
+TEST(MarkdownNodeTest, FencedCodeNode) {
+ StringRef Lines[] = {"int x = 0;"};
+ FencedCodeNode N("cpp", ArrayRef(Lines));
+ EXPECT_EQ(N.Kind, NodeKind::NK_FencedCode);
+ EXPECT_EQ(N.Lang, "cpp");
+ EXPECT_EQ(N.Lines.size(), 1u);
----------------
ilovepi wrote:
If you're going to test like this, I'd at least test that the array works with more than 1 item in it. It obviously will, but you're just testing invariants right now.
https://github.com/llvm/llvm-project/pull/205609
More information about the cfe-commits
mailing list