1 // RUN: rm -rf %t && mkdir -p %t
2 // RUN: clang-doc --format=html --output=%t --executor=standalone %s
3 // RUN: clang-doc --format=md --output=%t --executor=standalone %s
4 // RUN: FileCheck %s < %t/index_json.js -check-prefix=JSON-INDEX
5 // RUN: FileCheck %s < %t/@nonymous_namespace/AnonClass.html -check-prefix=HTML-ANON-CLASS-LINE
6 // RUN: FileCheck %s < %t/@nonymous_namespace/AnonClass.html -check-prefix=HTML-ANON-CLASS
7 // RUN: FileCheck %s < %t/@nonymous_namespace/index.html -check-prefix=HTML-ANON-INDEX-LINE
8 // RUN: FileCheck %s < %t/@nonymous_namespace/index.html -check-prefix=HTML-ANON-INDEX
9 // RUN: FileCheck %s < %t/AnotherNamespace/ClassInAnotherNamespace.html -check-prefix=HTML-ANOTHER-CLASS-LINE
10 // RUN: FileCheck %s < %t/AnotherNamespace/ClassInAnotherNamespace.html -check-prefix=HTML-ANOTHER-CLASS
11 // RUN: FileCheck %s < %t/AnotherNamespace/index.html -check-prefix=HTML-ANOTHER-INDEX-LINE
12 // RUN: FileCheck %s < %t/AnotherNamespace/index.html -check-prefix=HTML-ANOTHER-INDEX
13 // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.html -check-prefix=HTML-NESTED-CLASS-LINE
14 // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.html -check-prefix=HTML-NESTED-CLASS
15 // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/index.html -check-prefix=HTML-NESTED-INDEX-LINE
16 // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/index.html -check-prefix=HTML-NESTED-INDEX
17 // RUN: FileCheck %s < %t/PrimaryNamespace/index.html -check-prefix=HTML-PRIMARY-INDEX-LINE
18 // RUN: FileCheck %s < %t/PrimaryNamespace/index.html -check-prefix=HTML-PRIMARY-INDEX
19 // RUN: FileCheck %s < %t/PrimaryNamespace/ClassInPrimaryNamespace.html -check-prefix=HTML-PRIMARY-CLASS-LINE
20 // RUN: FileCheck %s < %t/PrimaryNamespace/ClassInPrimaryNamespace.html -check-prefix=HTML-PRIMARY-CLASS
21 // RUN: FileCheck %s < %t/@nonymous_namespace/AnonClass.md -check-prefix=MD-ANON-CLASS-LINE
22 // RUN: FileCheck %s < %t/@nonymous_namespace/AnonClass.md -check-prefix=MD-ANON-CLASS
23 // RUN: FileCheck %s < %t/@nonymous_namespace/index.md -check-prefix=MD-ANON-INDEX-LINE
24 // RUN: FileCheck %s < %t/@nonymous_namespace/index.md -check-prefix=MD-ANON-INDEX
25 // RUN: FileCheck %s < %t/AnotherNamespace/ClassInAnotherNamespace.md -check-prefix=MD-ANOTHER-CLASS-LINE
26 // RUN: FileCheck %s < %t/AnotherNamespace/ClassInAnotherNamespace.md -check-prefix=MD-ANOTHER-CLASS
27 // RUN: FileCheck %s < %t/AnotherNamespace/index.md -check-prefix=MD-ANOTHER-INDEX-LINE
28 // RUN: FileCheck %s < %t/AnotherNamespace/index.md -check-prefix=MD-ANOTHER-INDEX
29 // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.md -check-prefix=MD-NESTED-CLASS-LINE
30 // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.md -check-prefix=MD-NESTED-CLASS
31 // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/index.md -check-prefix=MD-NESTED-INDEX-LINE
32 // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/index.md -check-prefix=MD-NESTED-INDEX
33 // RUN: FileCheck %s < %t/PrimaryNamespace/index.md -check-prefix=MD-PRIMARY-INDEX-LINE
34 // RUN: FileCheck %s < %t/PrimaryNamespace/index.md -check-prefix=MD-PRIMARY-INDEX
35 // RUN: FileCheck %s < %t/PrimaryNamespace/ClassInPrimaryNamespace.md -check-prefix=MD-PRIMARY-CLASS-LINE
36 // RUN: FileCheck %s < %t/PrimaryNamespace/ClassInPrimaryNamespace.md -check-prefix=MD-PRIMARY-CLASS
37 // RUN: FileCheck %s < %t/GlobalNamespace/index.html -check-prefix=HTML-GLOBAL-INDEX
38 // RUN: FileCheck %s < %t/GlobalNamespace/index.md -check-prefix=MD-GLOBAL-INDEX
39 // RUN: FileCheck %s < %t/all_files.md -check-prefix=MD-ALL-FILES
40 // RUN: FileCheck %s < %t/index.md -check-prefix=MD-INDEX
44 // Anonymous Namespace
47 void anonFunction() {}
48 // MD-ANON-INDEX-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]*
49 // HTML-ANON-INDEX-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp</p>
52 // MD-ANON-CLASS-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]*
53 // HTML-ANON-CLASS-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp</p>
55 // MD-ANON-CLASS: # class AnonClass
56 // HTML-ANON-CLASS: <h1>class AnonClass</h1>
59 // MD-ANON-INDEX: # namespace @nonymous_namespace
60 // MD-ANON-INDEX: Anonymous Namespace
61 // MD-ANON-INDEX: ## Records
62 // MD-ANON-INDEX: * [AnonClass](AnonClass.md)
63 // MD-ANON-INDEX: ## Functions
64 // MD-ANON-INDEX: ### anonFunction
65 // MD-ANON-INDEX: *void anonFunction()*
67 // HTML-ANON-INDEX: <h1>namespace @nonymous_namespace</h1>
68 // HTML-ANON-INDEX: <p> Anonymous Namespace</p>
69 // HTML-ANON-INDEX: <h2 id="Records">Records</h2>
70 // HTML-ANON-INDEX: <a href="AnonClass.html">AnonClass</a>
71 // HTML-ANON-INDEX: <h2 id="Functions">Functions</h2>
72 // HTML-ANON-INDEX: <h3 id="{{([0-9A-F]{40})}}">anonFunction</h3>
73 // HTML-ANON-INDEX: <p>void anonFunction()</p>
77 namespace PrimaryNamespace
{
78 // Function in PrimaryNamespace
79 void functionInPrimaryNamespace() {}
80 // MD-PRIMARY-INDEX-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]*
81 // HTML-PRIMARY-INDEX-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp</p>
83 // Class in PrimaryNamespace
84 class ClassInPrimaryNamespace
{};
85 // MD-PRIMARY-CLASS-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]*
86 // HTML-PRIMARY-CLASS-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp</p>
88 // MD-PRIMARY-CLASS: # class ClassInPrimaryNamespace
89 // MD-PRIMARY-CLASS: Class in PrimaryNamespace
91 // HTML-PRIMARY-CLASS: <h1>class ClassInPrimaryNamespace</h1>
92 // HTML-PRIMARY-CLASS: <p> Class in PrimaryNamespace</p>
95 namespace NestedNamespace
{
96 // Function in NestedNamespace
97 void functionInNestedNamespace() {}
98 // MD-NESTED-INDEX-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]*
99 // HTML-NESTED-INDEX-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp</p>
101 // Class in NestedNamespace
102 class ClassInNestedNamespace
{};
103 // MD-NESTED-CLASS-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]*
104 // HTML-NESTED-CLASS-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp</p>
106 // MD-NESTED-CLASS: # class ClassInNestedNamespace
107 // MD-NESTED-CLASS: Class in NestedNamespace
109 // HTML-NESTED-CLASS: <h1>class ClassInNestedNamespace</h1>
110 // HTML-NESTED-CLASS: <p> Class in NestedNamespace</p>
113 // MD-NESTED-INDEX: # namespace NestedNamespace
114 // MD-NESTED-INDEX: Nested namespace
115 // MD-NESTED-INDEX: ## Records
116 // MD-NESTED-INDEX: * [ClassInNestedNamespace](ClassInNestedNamespace.md)
117 // MD-NESTED-INDEX: ## Functions
118 // MD-NESTED-INDEX: ### functionInNestedNamespace
119 // MD-NESTED-INDEX: *void functionInNestedNamespace()*
120 // MD-NESTED-INDEX: Function in NestedNamespace
122 // HTML-NESTED-INDEX: <h1>namespace NestedNamespace</h1>
123 // HTML-NESTED-INDEX: <p> Nested namespace</p>
124 // HTML-NESTED-INDEX: <h2 id="Records">Records</h2>
125 // HTML-NESTED-INDEX: <a href="ClassInNestedNamespace.html">ClassInNestedNamespace</a>
126 // HTML-NESTED-INDEX: <h2 id="Functions">Functions</h2>
127 // HTML-NESTED-INDEX: <h3 id="{{([0-9A-F]{40})}}">functionInNestedNamespace</h3>
128 // HTML-NESTED-INDEX: <p>void functionInNestedNamespace()</p>
129 // HTML-NESTED-INDEX: <p> Function in NestedNamespace</p>
132 // MD-PRIMARY-INDEX: # namespace PrimaryNamespace
133 // MD-PRIMARY-INDEX: Primary Namespace
134 // MD-PRIMARY-INDEX: ## Namespaces
135 // MD-PRIMARY-INDEX: * [NestedNamespace](NestedNamespace{{[\/]}}index.md)
136 // MD-PRIMARY-INDEX: ## Records
137 // MD-PRIMARY-INDEX: * [ClassInPrimaryNamespace](ClassInPrimaryNamespace.md)
138 // MD-PRIMARY-INDEX: ## Functions
139 // MD-PRIMARY-INDEX: ### functionInPrimaryNamespace
140 // MD-PRIMARY-INDEX: *void functionInPrimaryNamespace()*
141 // MD-PRIMARY-INDEX: Function in PrimaryNamespace
143 // HTML-PRIMARY-INDEX: <h1>namespace PrimaryNamespace</h1>
144 // HTML-PRIMARY-INDEX: <p> Primary Namespace</p>
145 // HTML-PRIMARY-INDEX: <h2 id="Namespaces">Namespaces</h2>
146 // HTML-PRIMARY-INDEX: <a href="NestedNamespace{{[\/]}}index.html">NestedNamespace</a>
147 // HTML-PRIMARY-INDEX: <h2 id="Records">Records</h2>
148 // HTML-PRIMARY-INDEX: <a href="ClassInPrimaryNamespace.html">ClassInPrimaryNamespace</a>
149 // HTML-PRIMARY-INDEX: <h2 id="Functions">Functions</h2>
150 // HTML-PRIMARY-INDEX: <h3 id="{{([0-9A-F]{40})}}">functionInPrimaryNamespace</h3>
151 // HTML-PRIMARY-INDEX: <p>void functionInPrimaryNamespace()</p>
152 // HTML-PRIMARY-INDEX: <p> Function in PrimaryNamespace</p>
156 namespace AnotherNamespace
{
157 // Function in AnotherNamespace
158 void functionInAnotherNamespace() {}
159 // MD-ANOTHER-INDEX-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]*
160 // HTML-ANOTHER-INDEX-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp</p>
162 // Class in AnotherNamespace
163 class ClassInAnotherNamespace
{};
164 // MD-ANOTHER-CLASS-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]*
165 // HTML-ANOTHER-CLASS-LINE: <p>Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp</p>
167 // MD-ANOTHER-CLASS: # class ClassInAnotherNamespace
168 // MD-ANOTHER-CLASS: Class in AnotherNamespace
170 // HTML-ANOTHER-CLASS: <h1>class ClassInAnotherNamespace</h1>
171 // HTML-ANOTHER-CLASS: <p> Class in AnotherNamespace</p>
175 // MD-ANOTHER-INDEX: # namespace AnotherNamespace
176 // MD-ANOTHER-INDEX: AnotherNamespace
177 // MD-ANOTHER-INDEX: ## Records
178 // MD-ANOTHER-INDEX: * [ClassInAnotherNamespace](ClassInAnotherNamespace.md)
179 // MD-ANOTHER-INDEX: ## Functions
180 // MD-ANOTHER-INDEX: ### functionInAnotherNamespace
181 // MD-ANOTHER-INDEX: *void functionInAnotherNamespace()*
182 // MD-ANOTHER-INDEX: Function in AnotherNamespace
184 // HTML-ANOTHER-INDEX: <h1>namespace AnotherNamespace</h1>
185 // HTML-ANOTHER-INDEX: <p> AnotherNamespace</p>
186 // HTML-ANOTHER-INDEX: <h2 id="Records">Records</h2>
187 // HTML-ANOTHER-INDEX: <a href="ClassInAnotherNamespace.html">ClassInAnotherNamespace</a>
188 // HTML-ANOTHER-INDEX: <h2 id="Functions">Functions</h2>
189 // HTML-ANOTHER-INDEX: <h3 id="{{([0-9A-F]{40})}}">functionInAnotherNamespace</h3>
190 // HTML-ANOTHER-INDEX: <p>void functionInAnotherNamespace()</p>
191 // HTML-ANOTHER-INDEX: <p> Function in AnotherNamespace</p>
193 // JSON-INDEX: async function LoadIndex() {
194 // JSON-INDEX-NEXT: return{
195 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
196 // JSON-INDEX-NEXT: "Name": "",
197 // JSON-INDEX-NEXT: "RefType": "default",
198 // JSON-INDEX-NEXT: "Path": "",
199 // JSON-INDEX-NEXT: "Children": [
200 // JSON-INDEX-NEXT: {
201 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
202 // JSON-INDEX-NEXT: "Name": "@nonymous_namespace",
203 // JSON-INDEX-NEXT: "RefType": "namespace",
204 // JSON-INDEX-NEXT: "Path": "@nonymous_namespace",
205 // JSON-INDEX-NEXT: "Children": [
206 // JSON-INDEX-NEXT: {
207 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
208 // JSON-INDEX-NEXT: "Name": "AnonClass",
209 // JSON-INDEX-NEXT: "RefType": "record",
210 // JSON-INDEX-NEXT: "Path": "@nonymous_namespace",
211 // JSON-INDEX-NEXT: "Children": []
212 // JSON-INDEX-NEXT: }
213 // JSON-INDEX-NEXT: ]
214 // JSON-INDEX-NEXT: },
215 // JSON-INDEX-NEXT: {
216 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
217 // JSON-INDEX-NEXT: "Name": "AnotherNamespace",
218 // JSON-INDEX-NEXT: "RefType": "namespace",
219 // JSON-INDEX-NEXT: "Path": "AnotherNamespace",
220 // JSON-INDEX-NEXT: "Children": [
221 // JSON-INDEX-NEXT: {
222 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
223 // JSON-INDEX-NEXT: "Name": "ClassInAnotherNamespace",
224 // JSON-INDEX-NEXT: "RefType": "record",
225 // JSON-INDEX-NEXT: "Path": "AnotherNamespace",
226 // JSON-INDEX-NEXT: "Children": []
227 // JSON-INDEX-NEXT: }
228 // JSON-INDEX-NEXT: ]
229 // JSON-INDEX-NEXT: },
230 // JSON-INDEX-NEXT: {
231 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
232 // JSON-INDEX-NEXT: "Name": "GlobalNamespace",
233 // JSON-INDEX-NEXT: "RefType": "namespace",
234 // JSON-INDEX-NEXT: "Path": "GlobalNamespace",
235 // JSON-INDEX-NEXT: "Children": []
236 // JSON-INDEX-NEXT: },
237 // JSON-INDEX-NEXT: {
238 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
239 // JSON-INDEX-NEXT: "Name": "PrimaryNamespace",
240 // JSON-INDEX-NEXT: "RefType": "namespace",
241 // JSON-INDEX-NEXT: "Path": "PrimaryNamespace",
242 // JSON-INDEX-NEXT: "Children": [
243 // JSON-INDEX-NEXT: {
244 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
245 // JSON-INDEX-NEXT: "Name": "ClassInPrimaryNamespace",
246 // JSON-INDEX-NEXT: "RefType": "record",
247 // JSON-INDEX-NEXT: "Path": "PrimaryNamespace",
248 // JSON-INDEX-NEXT: "Children": []
249 // JSON-INDEX-NEXT: },
250 // JSON-INDEX-NEXT: {
251 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
252 // JSON-INDEX-NEXT: "Name": "NestedNamespace",
253 // JSON-INDEX-NEXT: "RefType": "namespace",
254 // JSON-INDEX-NEXT: "Path": "PrimaryNamespace{{[\/]+}}NestedNamespace",
255 // JSON-INDEX-NEXT: "Children": [
256 // JSON-INDEX-NEXT: {
257 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
258 // JSON-INDEX-NEXT: "Name": "ClassInNestedNamespace",
259 // JSON-INDEX-NEXT: "RefType": "record",
260 // JSON-INDEX-NEXT: "Path": "PrimaryNamespace{{[\/]+}}NestedNamespace",
261 // JSON-INDEX-NEXT: "Children": []
262 // JSON-INDEX-NEXT: }
263 // JSON-INDEX-NEXT: ]
264 // JSON-INDEX-NEXT: }
265 // JSON-INDEX-NEXT: ]
266 // JSON-INDEX-NEXT: }
267 // JSON-INDEX-NEXT: ]
268 // JSON-INDEX-NEXT: };
269 // JSON-INDEX-NEXT: }
271 // HTML-GLOBAL-INDEX: <div id="main-content" class="col-xs-12 col-sm-9 col-md-8 main-content">
272 // HTML-GLOBAL-INDEX: <h1>Global Namespace</h1>
273 // HTML-GLOBAL-INDEX: <h2 id="Namespaces">Namespaces</h2>
274 // HTML-GLOBAL-INDEX: <li>@nonymous_namespace</li>
275 // HTML-GLOBAL-INDEX: <li>AnotherNamespace</li>
276 // HTML-GLOBAL-INDEX: <li>PrimaryNamespace</li>
279 // MD-GLOBAL-INDEX: # Global Namespace
280 // MD-GLOBAL-INDEX: ## Namespaces
281 // MD-GLOBAL-INDEX: * [@nonymous_namespace](..{{[\/]}}@nonymous_namespace{{[\/]}}index.md)
282 // MD-GLOBAL-INDEX: * [AnotherNamespace](..{{[\/]}}AnotherNamespace{{[\/]}}index.md)
283 // MD-GLOBAL-INDEX: * [PrimaryNamespace](..{{[\/]}}PrimaryNamespace{{[\/]}}index.md)
286 // MD-ALL-FILES: # All Files
287 // MD-ALL-FILES: ## [@nonymous_namespace](@nonymous_namespace{{[\/]}}index.md)
288 // MD-ALL-FILES: ## [AnotherNamespace](AnotherNamespace{{[\/]}}index.md)
289 // MD-ALL-FILES: ## [GlobalNamespace](GlobalNamespace{{[\/]}}index.md)
290 // MD-ALL-FILES: ## [PrimaryNamespace](PrimaryNamespace{{[\/]}}index.md)
292 // MD-INDEX: # C/C++ Reference
293 // MD-INDEX: * Namespace: [@nonymous_namespace](@nonymous_namespace)
294 // MD-INDEX: * Namespace: [AnotherNamespace](AnotherNamespace)
295 // MD-INDEX: * Namespace: [PrimaryNamespace](PrimaryNamespace)