-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[clang-doc] Add Mustache output to enum tests #170195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
evelez7
merged 1 commit into
main
from
users/evelez7/clang-doc-precommit-mustache-enum-tests
Dec 4, 2025
Merged
[clang-doc] Add Mustache output to enum tests #170195
evelez7
merged 1 commit into
main
from
users/evelez7/clang-doc-precommit-mustache-enum-tests
Dec 4, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
Author
This was referenced Dec 1, 2025
Member
|
@llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) ChangesFull diff: https://github.com/llvm/llvm-project/pull/170195.diff 1 Files Affected:
diff --git a/clang-tools-extra/test/clang-doc/enum.cpp b/clang-tools-extra/test/clang-doc/enum.cpp
index b05d8e2029070..ec4ddcaa82b32 100644
--- a/clang-tools-extra/test/clang-doc/enum.cpp
+++ b/clang-tools-extra/test/clang-doc/enum.cpp
@@ -1,12 +1,19 @@
// RUN: rm -rf %t && mkdir -p %t
// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s
// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s
+// RUN: clang-doc --format=mustache --doxygen --output=%t --executor=standalone %s
// RUN: FileCheck %s < %t/GlobalNamespace/index.html --check-prefix=HTML-INDEX-LINE
// RUN: FileCheck %s < %t/GlobalNamespace/index.html --check-prefix=HTML-INDEX
// RUN: FileCheck %s < %t/GlobalNamespace/Animals.html --check-prefix=HTML-ANIMAL-LINE
// RUN: FileCheck %s < %t/GlobalNamespace/Animals.html --check-prefix=HTML-ANIMAL
// RUN: FileCheck %s < %t/Vehicles/index.html --check-prefix=HTML-VEHICLES-LINE
// RUN: FileCheck %s < %t/Vehicles/index.html --check-prefix=HTML-VEHICLES
+// RUN: FileCheck %s < %t/html/GlobalNamespace/index.html --check-prefix=MUSTACHE-INDEX-LINE
+// RUN: FileCheck %s < %t/html/GlobalNamespace/index.html --check-prefix=MUSTACHE-INDEX
+// RUN: FileCheck %s < %t/html/GlobalNamespace/_ZTV7Animals.html --check-prefix=MUSTACHE-ANIMAL-LINE
+// RUN: FileCheck %s < %t/html/GlobalNamespace/_ZTV7Animals.html --check-prefix=MUSTACHE-ANIMAL
+// RUN: FileCheck %s < %t/html/Vehicles/index.html --check-prefix=MUSTACHE-VEHICLES-LINE
+// RUN: FileCheck %s < %t/html/Vehicles/index.html --check-prefix=MUSTACHE-VEHICLES
// RUN: FileCheck %s < %t/GlobalNamespace/index.md --check-prefix=MD-INDEX-LINE
// RUN: FileCheck %s < %t/GlobalNamespace/index.md --check-prefix=MD-INDEX
// RUN: FileCheck %s < %t/GlobalNamespace/Animals.md --check-prefix=MD-ANIMAL-LINE
@@ -14,12 +21,15 @@
// RUN: FileCheck %s < %t/Vehicles/index.md --check-prefix=MD-VEHICLES-LINE
// RUN: FileCheck %s < %t/Vehicles/index.md --check-prefix=MD-VEHICLES
+// COM: FIXME: Add enum value comments to template
+
/**
* @brief For specifying RGB colors
*/
enum Color {
// MD-INDEX-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#[[@LINE-1]]*
// HTML-INDEX-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
+ // MUSTACHE-INDEX-LINE-NOT: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
Red, ///< Comment 1
Green, ///< Comment 2
Blue ///< Comment 3
@@ -44,12 +54,41 @@ enum Color {
// HTML-INDEX: <td>2</td>
// HTML-INDEX: <p> Comment 3</p>
+// MUSTACHE-INDEX: <div>
+// MUSTACHE-INDEX: <pre>
+// MUSTACHE-INDEX: <code class="language-cpp code-clang-doc">
+// MUSTACHE-INDEX: enum Color
+// MUSTACHE-INDEX: </code>
+// MUSTACHE-INDEX: </pre>
+// MUSTACHE-INDEX: </div>
+// MUSTACHE-INDEX: <table class="table-wrapper">
+// MUSTACHE-INDEX: <tbody>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <th>Name</th>
+// MUSTACHE-INDEX: <th>Value</th>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <td>Red</td>
+// MUSTACHE-INDEX: <td>0</td>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <td>Green</td>
+// MUSTACHE-INDEX: <td>1</td>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <td>Blue</td>
+// MUSTACHE-INDEX: <td>2</td>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: </tbody>
+// MUSTACHE-INDEX: </table>
+
/**
* @brief Shape Types
*/
enum class Shapes {
// MD-INDEX-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#[[@LINE-1]]*
// HTML-INDEX-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
+ // MUSTACHE-INDEX-LINE-NOT: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
/// Comment 1
Circle,
@@ -76,9 +115,40 @@ enum class Shapes {
// HTML-INDEX: <td>2</td>
// HTML-INDEX: <p> Comment 3</p>
+// COM: FIXME: Serialize "enum class" in template
+// MUSTACHE-INDEX: <div>
+// MUSTACHE-INDEX: <pre>
+// MUSTACHE-INDEX: <code class="language-cpp code-clang-doc">
+// MUSTACHE-INDEX: enum Shapes
+// MUSTACHE-INDEX: </code>
+// MUSTACHE-INDEX: </pre>
+// MUSTACHE-INDEX: </div>
+// MUSTACHE-INDEX: <table class="table-wrapper">
+// MUSTACHE-INDEX: <tbody>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <th>Name</th>
+// MUSTACHE-INDEX: <th>Value</th>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <td>Circle</td>
+// MUSTACHE-INDEX: <td>0</td>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <td>Rectangle</td>
+// MUSTACHE-INDEX: <td>1</td>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <td>Triangle</td>
+// MUSTACHE-INDEX: <td>2</td>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: </tbody>
+// MUSTACHE-INDEX: </table>
+
+// COM: FIXME: Add enums declared inside of classes to class template
class Animals {
// MD-ANIMAL-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#[[@LINE-1]]*
// HTML-ANIMAL-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
+ // MUSTACHE-ANIMAL-LINE: <p>Defined at line [[@LINE-3]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
public:
/**
* @brief specify what animal the class is
@@ -86,6 +156,7 @@ class Animals {
enum AnimalType {
// MD-ANIMAL-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#[[@LINE-1]]*
// HTML-ANIMAL-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
+ // MUSTACHE-ANIMAL-LINE-NOT: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
Dog, ///< Man's best friend
Cat, ///< Man's other best friend
Iguana ///< A lizard
@@ -105,6 +176,19 @@ class Animals {
// HTML-ANIMAL: <td>2</td>
// HTML-ANIMAL: <p> A lizard</p>
+// MUSTACHE-ANIMAL-NOT: <h1>class Animals</h1>
+// MUSTACHE-ANIMAL-NOT: <h2 id="Enums">Enums</h2>
+// MUSTACHE-ANIMAL-NOT: <th colspan="3">enum AnimalType</th>
+// MUSTACHE-ANIMAL-NOT: <td>Dog</td>
+// MUSTACHE-ANIMAL-NOT: <td>0</td>
+// MUSTACHE-ANIMAL-NOT: <p> Man's best friend</p>
+// MUSTACHE-ANIMAL-NOT: <td>Cat</td>
+// MUSTACHE-ANIMAL-NOT: <td>1</td>
+// MUSTACHE-ANIMAL-NOT: <p> Man's other best friend</p>
+// MUSTACHE-ANIMAL-NOT: <td>Iguana</td>
+// MUSTACHE-ANIMAL-NOT: <td>2</td>
+// MUSTACHE-ANIMAL-NOT: <p> A lizard</p>
+
// MD-ANIMAL: # class Animals
// MD-ANIMAL: ## Enums
// MD-ANIMAL: | enum AnimalType |
@@ -121,6 +205,7 @@ namespace Vehicles {
enum Car {
// MD-VEHICLES-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#[[@LINE-1]]*
// HTML-VEHICLES-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
+ // MUSTACHE-VEHICLES-LINE: Defined at line [[@LINE-3]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp
Sedan, ///< Comment 1
SUV, ///< Comment 2
@@ -154,6 +239,38 @@ enum Car {
// HTML-VEHICLES: <td>3</td>
// HTML-VEHICLES: <p> Comment 4</p>
+// MUSTACHE-VEHICLES: <div>
+// MUSTACHE-VEHICLES: <pre>
+// MUSTACHE-VEHICLES: <code class="language-cpp code-clang-doc">
+// MUSTACHE-VEHICLES: enum Car
+// MUSTACHE-VEHICLES: </code>
+// MUSTACHE-VEHICLES: </pre>
+// MUSTACHE-VEHICLES: </div>
+// MUSTACHE-VEHICLES: <table class="table-wrapper">
+// MUSTACHE-VEHICLES: <tbody>
+// MUSTACHE-VEHICLES: <tr>
+// MUSTACHE-VEHICLES: <th>Name</th>
+// MUSTACHE-VEHICLES: <th>Value</th>
+// MUSTACHE-VEHICLES: </tr>
+// MUSTACHE-VEHICLES: <tr>
+// MUSTACHE-VEHICLES: <td>Sedan</td>
+// MUSTACHE-VEHICLES: <td>0</td>
+// MUSTACHE-VEHICLES: </tr>
+// MUSTACHE-VEHICLES: <tr>
+// MUSTACHE-VEHICLES: <td>SUV</td>
+// MUSTACHE-VEHICLES: <td>1</td>
+// MUSTACHE-VEHICLES: </tr>
+// MUSTACHE-VEHICLES: <tr>
+// MUSTACHE-VEHICLES: <td>Pickup</td>
+// MUSTACHE-VEHICLES: <td>2</td>
+// MUSTACHE-VEHICLES: </tr>
+// MUSTACHE-VEHICLES: <tr>
+// MUSTACHE-VEHICLES: <td>Hatchback</td>
+// MUSTACHE-VEHICLES: <td>3</td>
+// MUSTACHE-VEHICLES: </tr>
+// MUSTACHE-VEHICLES: </tbody>
+// MUSTACHE-VEHICLES: </table>
+
enum ColorUserSpecified {
RedUserSpecified = 'A',
GreenUserSpecified = 2,
@@ -173,3 +290,31 @@ enum ColorUserSpecified {
// HTML-INDEX: <td>2</td>
// HTML-INDEX: <td>BlueUserSpecified</td>
// HTML-INDEX: <td>'C'</td>
+
+// MUSTACHE-INDEX: <div>
+// MUSTACHE-INDEX: <pre>
+// MUSTACHE-INDEX: <code class="language-cpp code-clang-doc">
+// MUSTACHE-INDEX: enum ColorUserSpecified
+// MUSTACHE-INDEX: </code>
+// MUSTACHE-INDEX: </pre>
+// MUSTACHE-INDEX: </div>
+// MUSTACHE-INDEX: <table class="table-wrapper">
+// MUSTACHE-INDEX: <tbody>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <th>Name</th>
+// MUSTACHE-INDEX: <th>Value</th>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <td>RedUserSpecified</td>
+// MUSTACHE-INDEX: <td>'A'</td>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <td>GreenUserSpecified</td>
+// MUSTACHE-INDEX: <td>2</td>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: <tr>
+// MUSTACHE-INDEX: <td>BlueUserSpecified</td>
+// MUSTACHE-INDEX: <td>'C'</td>
+// MUSTACHE-INDEX: </tr>
+// MUSTACHE-INDEX: </tbody>
+// MUSTACHE-INDEX: </table>
\ No newline at end of file
|
Member
Author
|
Test HTML: https://erickvelez.com/clang-doc-mustache-output/enums-precommit/GlobalNamespace/ Note that the indentation is fixed in the PR above this. |
ilovepi
approved these changes
Dec 1, 2025
a8103e6 to
41503c8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

No description provided.