Skip to content

Commit a63fd59

Browse files
authored
[clang-doc] Add regression test for test comments in macros (#132510)
Fixes #59819. The underlying problem was fixed in https://reviews.llvm.org/D142560, but this patch adds a proper regression test.
1 parent 46e99ac commit a63fd59

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Regression test for https://github.com/llvm/llvm-project/issues/59819
2+
3+
// RUN: rm -rf %t && mkdir -p %t
4+
// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s
5+
// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MYCLASS-LINE
6+
// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MYCLASS
7+
8+
// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s
9+
// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MYCLASS-LINE
10+
// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MYCLASS
11+
12+
#define DECLARE_METHODS \
13+
/**
14+
* @brief Declare a method to calculate the sum of two numbers
15+
*/ \
16+
int Add(int a, int b) { \
17+
return a + b; \
18+
}
19+
20+
// MD-MYCLASS: ### Add
21+
// MD-MYCLASS: *public int Add(int a, int b)*
22+
// MD-MYCLASS: **brief** Declare a method to calculate the sum of two numbers
23+
24+
// HTML-MYCLASS: <p>public int Add(int a, int b)</p>
25+
// HTML-MYCLASS: <div>brief</div>
26+
// HTML-MYCLASS: <p> Declare a method to calculate the sum of two numbers</p>
27+
28+
29+
class MyClass {
30+
public:
31+
// MD-MYCLASS-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}comments-in-macros.cpp#[[@LINE+2]]*
32+
// HTML-MYCLASS-LINE: <p>Defined at line [[@LINE+1]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}comments-in-macros.cpp</p>
33+
DECLARE_METHODS
34+
};
35+

0 commit comments

Comments
 (0)