[clang-tools-extra] [clang-doc] add enum test (PR #97679)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 3 22:37:56 PDT 2024
https://github.com/PeterChou1 created https://github.com/llvm/llvm-project/pull/97679
This patch adds a test which test the enum generation for clang-doc.
>From b5e0335199541225a1b0eb5eaf661cd4df55dbd7 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Thu, 4 Jul 2024 01:14:11 -0400
Subject: [PATCH] [clang-doc] add enum test
---
clang-tools-extra/test/clang-doc/enum.cpp | 38 +++++++++++++++++++++++
1 file changed, 38 insertions(+)
create mode 100644 clang-tools-extra/test/clang-doc/enum.cpp
diff --git a/clang-tools-extra/test/clang-doc/enum.cpp b/clang-tools-extra/test/clang-doc/enum.cpp
new file mode 100644
index 0000000000000..2f25eaf4e44e2
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/enum.cpp
@@ -0,0 +1,38 @@
+// RUN: clang-doc --format=html --doxygen --output=%t/docs --executor=standalone %s
+// RUN: clang-doc --format=md --doxygen --output=%t/docs --executor=standalone %s
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.html -check-prefix=HTML-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.md -check-prefix=MD-INDEX
+
+/**
+ * @brief For specifying RGB colors
+ */
+enum Color {
+ Red, // Red enums
+ Green, // Green enums
+ Blue // Blue enums
+};
+
+// HTML-INDEX: <h1>Global Namespace</h1>
+// HTML-INDEX: <h2 id="Enums">Enums</h2>
+// HTML-INDEX: <div>
+// HTML-INDEX: <h3 id="{{([0-9A-F]{40})}}">enum Color</h3>
+// HTML-INDEX: <ul>
+// HTML-INDEX: <li>Red</li>
+// HTML-INDEX: <li>Green</li>
+// HTML-INDEX: <li>Blue</li>
+// HTML-INDEX: </ul>
+// HTML-INDEX: <p>Defined at line 11 of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
+// HTML-INDEX: <div>
+// HTML-INDEX: <div></div>
+// HTML-INDEX: </div>
+// HTML-INDEX: </div>
+
+// MD-INDEX: # Global Namespace
+// MD-INDEX: ## Enums
+// MD-INDEX: | enum Color |
+// MD-INDEX: --
+// MD-INDEX: | Red |
+// MD-INDEX: | Green |
+// MD-INDEX: | Blue |
+// MD-INDEX: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#11*
+// MD-INDEX: **brief** For specifying RGB colors
\ No newline at end of file
More information about the cfe-commits
mailing list