Skip to content

Commit 52e2591

Browse files
authored
[clang-doc] Add tests for Markdown output with C++ templates
Reviewers: PeterChou1, petrhosek Reviewed By: petrhosek Pull Request: #119813
1 parent 5747ad4 commit 52e2591

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

clang-tools-extra/test/clang-doc/templates.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
// RUN: rm -rf %t
22
// RUN: mkdir %t
3+
34
// RUN: clang-doc --doxygen --executor=standalone %s -output=%t/docs
45
// RUN: cat %t/docs/index.yaml | FileCheck %s --check-prefix=YAML
56

7+
// RUN: clang-doc --doxygen --executor=standalone %s -output=%t/docs --format=md
8+
// RUN: cat %t/docs/GlobalNamespace/index.md | FileCheck %s --check-prefix=MD
9+
610
// YAML: ---
711
// YAML-NEXT: USR: '{{([0-9A-F]{40})}}'
812

13+
// MD: # Global Namespace
14+
// MD: ## Functions
15+
916
template<class... T>
1017
void ParamPackFunction(T... args);
1118

@@ -28,6 +35,9 @@ void ParamPackFunction(T... args);
2835
// YAML-NEXT: Params:
2936
// YAML-NEXT: - Contents: 'class... T'
3037

38+
// MD: ### ParamPackFunction
39+
// MD: *void ParamPackFunction(T... args)*
40+
3141
template<typename T, int U = 1>
3242
void function(T x) {}
3343

@@ -50,6 +60,10 @@ void function(T x) {}
5060
// YAML-NEXT: - Contents: 'typename T'
5161
// YAML-NEXT: - Contents: 'int U = 1'
5262

63+
// MD: ### function
64+
// MD: *void function(T x)*
65+
// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 23]]*
66+
5367
template<>
5468
void function<bool, 0>(bool x) {}
5569

@@ -75,3 +89,7 @@ void function<bool, 0>(bool x) {}
7589
// YAML-NEXT: - Contents: '0'
7690
// YAML-NEXT: ...
7791

92+
// MD: ### function
93+
// MD: *void function(_Bool x)*
94+
// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 27]]*
95+

0 commit comments

Comments
 (0)