[clang-tools-extra] [clang-doc] add enum test (PR #97679)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 15 18:10:17 PDT 2024


================
@@ -0,0 +1,128 @@
+// 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: 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
+
+
+
+// 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
----------------
ilovepi wrote:

This is a lot better, but maybe its better to move this and the HTML line check below the LINE you want to check and then do

```
enum Color {
// MD-INDEX: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#[[@LINE-1]]*
// HTML-INDEX: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp</p>
```
Any remaining checks can go below the class, or these line checks could be MD-INDEX-LINE & HTML-INDEX-LINE, and you can list 2 prefixes to check, then only the 2 line checks would be out of order w/ the rest. WDYT?

https://github.com/llvm/llvm-project/pull/97679


More information about the cfe-commits mailing list