Skip to content

Commit

Permalink
[clang-doc] update test to use @line directive
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterChou1 committed Jul 15, 2024
1 parent 517bb21 commit ec796d6
Showing 1 changed file with 83 additions and 76 deletions.
159 changes: 83 additions & 76 deletions clang-tools-extra/test/clang-doc/enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,105 +9,92 @@
// RUN: FileCheck %s < %t/Vehicles/index.md -check-prefix=MD-VEHICLES



// 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#[[@LINE+13]]*
// MD-INDEX: **brief** For specifying RGB colors

// 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 [[@LINE+4]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
/**
* @brief For specifying RGB colors
*/
enum Color {
Red, // Red
Green, // Green
Blue // Blue
Red, ///< Red
Green, ///< Green
Blue ///< Blue
};


// MD-INDEX: | enum Shapes |
// MD-INDEX: --
// MD-INDEX: | Circle |
// MD-INDEX: | Rectangle |
// MD-INDEX: | Triangle |
// MD-INDEX: *Defined at A:\clion-llvm\llvm-project\clang-tools-extra\test\clang-doc\enum.cpp#[[@LINE+11]]*
// MD-INDEX: **brief** Shape Types

// 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 [[@LINE+4]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
/**
* @brief Shape Types
*/
enum Shapes {
// Circle
/// Circle
Circle,
// Rectangle
/// Rectangle
Rectangle,
// Triangle
/// 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 {{.*}} 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
// 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#{{.*}}*
// 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: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#[[@LINE+18]]*
// 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: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#[[@LINE+16]]*
// MD-ANIMAL: **brief** specify what animal the class is

// HTML-ANIMAL: <h1>class Animals</h1>
// HTML-ANIMAL: <p>Defined at line [[@LINE+7]] 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 [[@LINE+6]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
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
};
};



// MD-VEHICLES: # namespace Vehicles
// MD-VEHICLES: ## Enums
Expand All @@ -117,5 +104,25 @@ namespace Vehicles {
// 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
// MD-VEHICLES: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#[[@LINE+15]]*
// MD-VEHICLES: **brief** specify type of car

// 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 [[@LINE+5]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
namespace Vehicles {
/**
* @brief specify type of car
*/
enum Car {
Sedan, /// Sedan
SUV, /// SUV
Pickup, /// Pickup
Hatchback /// Hatchback
};
}

0 comments on commit ec796d6

Please sign in to comment.