Skip to content

Commit

Permalink
[clang-doc] add extra test cases to enum
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterChou1 committed Jul 15, 2024
1 parent cd98a8c commit 517bb21
Showing 1 changed file with 95 additions and 6 deletions.
101 changes: 95 additions & 6 deletions clang-tools-extra/test/clang-doc/enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,90 @@
// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s
// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s
// RUN: FileCheck %s < %t/GlobalNamespace/index.html -check-prefix=HTML-INDEX
// RUN: FileCheck %s < %t/GlobalNamespace/Animals.html -check-prefix=HTML-ANIMAL
// RUN: FileCheck %s < %t/Vehicles/index.html -check-prefix=HTML-VEHICLES
// RUN: FileCheck %s < %t/GlobalNamespace/index.md -check-prefix=MD-INDEX
// RUN: FileCheck %s < %t/GlobalNamespace/Animals.md -check-prefix=MD-ANIMAL
// RUN: FileCheck %s < %t/Vehicles/index.md -check-prefix=MD-VEHICLES


/**
* @brief For specifying RGB colors
*/
enum Color {
Red,
Green,
Blue
Red, // Red
Green, // Green
Blue // Blue
};

/**
* @brief Shape Types
*/
enum Shapes {
// Circle
Circle,
// Rectangle
Rectangle,
// Triangle
Triangle
};

class Animals {
public:
/**
* @brief specify what animal the class is
*/
enum AnimalType {
Dog, // Man's best friend
Cat, // Man's other best friend
Iguana // A lizard
};
};


namespace Vehicles {
/**
* @brief specify type of car
*/
enum Car {
Sedan, // Sedan
SUV, // SUV
Pickup, // Pickup
Hatchback // Hatchback
};
}


// HTML-INDEX: <h1>Global Namespace</h1>
// HTML-INDEX: <h2 id="Enums">Enums</h2>
// HTML-INDEX: <h3 id="{{([0-9A-F]{40})}}">enum Color</h3>
// HTML-INDEX: <li>Red</li>
// HTML-INDEX: <li>Green</li>
// HTML-INDEX: <li>Blue</li>
// HTML-INDEX: <p>Defined at line 10 of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
// HTML-INDEX: <p>Defined at line {{.*}} of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
// HTML-INDEX: <h3 id="{{([0-9A-F]{40})}}">enum Shapes</h3>
// HTML-INDEX: <li>Circle</li>
// HTML-INDEX: <li>Rectangle</li>
// HTML-INDEX: <li>Triangle</li>
// HTML-INDEX: <p>Defined at line {{.*}} of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>

// HTML-ANIMAL: <h1>class Animals</h1>
// HTML-ANIMAL: <p>Defined at line {{.*}} of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
// HTML-ANIMAL: <h2 id="Enums">Enums</h2>
// HTML-ANIMAL: <h3 id="{{([0-9A-F]{40})}}">enum AnimalType</h3>
// HTML-ANIMAL: <li>Dog</li>
// HTML-ANIMAL: <li>Cat</li>
// HTML-ANIMAL: <li>Iguana</li>
// HTML-ANIMAL: <p>Defined at line {{.*}} of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>

// HTML-VEHICLES: <h1>namespace Vehicles</h1>
// HTML-VEHICLES: <h2 id="Enums">Enums</h2>
// HTML-VEHICLES: <h3 id="{{([0-9A-F]{40})}}">enum Car</h3>
// HTML-VEHICLES: <li>Sedan</li>
// HTML-VEHICLES: <li>SUV</li>
// HTML-VEHICLES: <li>Pickup</li>
// HTML-VEHICLES: <li>Hatchback</li>
// HTML-VEHICLES: <p>Defined at line {{.*}} of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>

// MD-INDEX: # Global Namespace
// MD-INDEX: ## Enums
Expand All @@ -28,5 +94,28 @@ enum Color {
// MD-INDEX: | Red |
// MD-INDEX: | Green |
// MD-INDEX: | Blue |
// MD-INDEX: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#10*
// MD-INDEX: **brief** For specifying RGB colors
// MD-INDEX: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#{{.*}}*
// MD-INDEX: **brief** For specifying RGB colors

// MD-ANIMAL: # class Animals
// MD-ANIMAL: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#{{.*}}*
// MD-ANIMAL: ## Enums
// MD-ANIMAL: | enum AnimalType |
// MD-ANIMAL: --
// MD-ANIMAL: | Dog |
// MD-ANIMAL: | Cat |
// MD-ANIMAL: | Iguana |
// MD-ANIMAL: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#{{.*}}*
// MD-ANIMAL: **brief** specify what animal the class is


// MD-VEHICLES: # namespace Vehicles
// MD-VEHICLES: ## Enums
// MD-VEHICLES: | enum Car |
// MD-VEHICLES: --
// MD-VEHICLES: | Sedan |
// MD-VEHICLES: | SUV |
// MD-VEHICLES: | Pickup |
// MD-VEHICLES: | Hatchback |
// MD-VEHICLES: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#{{.*}}*
// MD-VEHICLES: **brief** specify type of car

0 comments on commit 517bb21

Please sign in to comment.