Debian Codegraph @

clang-tools-extra/test/clang-doc/basic-project.test

raw
1 // RUN: rm -rf %t && mkdir -p %t/docs %t/build
2 // RUN: sed 's|$test_dir|%/S|g' %S/Inputs/basic-project/database_template.json > %t/build/compile_commands.json
3 // RUN: clang-doc --format=html --output=%t/docs --executor=all-TUs %t/build/compile_commands.json
4 // RUN: FileCheck %s -input-file=%t/docs/index_json.js -check-prefix=JSON-INDEX
5 // RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Shape.html -check-prefix=HTML-SHAPE
6 // RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Calculator.html -check-prefix=HTML-CALC
7 // RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Rectangle.html -check-prefix=HTML-RECTANGLE
8 // RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Circle.html -check-prefix=HTML-CIRCLE
9
10 // JSON-INDEX: async function LoadIndex() {
11 // JSON-INDEX-NEXT: return{
12 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
13 // JSON-INDEX-NEXT: "Name": "",
14 // JSON-INDEX-NEXT: "RefType": "default",
15 // JSON-INDEX-NEXT: "Path": "",
16 // JSON-INDEX-NEXT: "Children": [
17 // JSON-INDEX-NEXT: {
18 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
19 // JSON-INDEX-NEXT: "Name": "GlobalNamespace",
20 // JSON-INDEX-NEXT: "RefType": "namespace",
21 // JSON-INDEX-NEXT: "Path": "GlobalNamespace",
22 // JSON-INDEX-NEXT: "Children": [
23 // JSON-INDEX-NEXT: {
24 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
25 // JSON-INDEX-NEXT: "Name": "Calculator",
26 // JSON-INDEX-NEXT: "RefType": "record",
27 // JSON-INDEX-NEXT: "Path": "GlobalNamespace",
28 // JSON-INDEX-NEXT: "Children": []
29 // JSON-INDEX-NEXT: },
30 // JSON-INDEX-NEXT: {
31 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
32 // JSON-INDEX-NEXT: "Name": "Circle",
33 // JSON-INDEX-NEXT: "RefType": "record",
34 // JSON-INDEX-NEXT: "Path": "GlobalNamespace",
35 // JSON-INDEX-NEXT: "Children": []
36 // JSON-INDEX-NEXT: },
37 // JSON-INDEX-NEXT: {
38 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
39 // JSON-INDEX-NEXT: "Name": "Rectangle",
40 // JSON-INDEX-NEXT: "RefType": "record",
41 // JSON-INDEX-NEXT: "Path": "GlobalNamespace",
42 // JSON-INDEX-NEXT: "Children": []
43 // JSON-INDEX-NEXT: },
44 // JSON-INDEX-NEXT: {
45 // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
46 // JSON-INDEX-NEXT: "Name": "Shape",
47 // JSON-INDEX-NEXT: "RefType": "record",
48 // JSON-INDEX-NEXT: "Path": "GlobalNamespace",
49 // JSON-INDEX-NEXT: "Children": []
50 // JSON-INDEX-NEXT: }
51 // JSON-INDEX-NEXT: ]
52 // JSON-INDEX-NEXT: }
53 // JSON-INDEX-NEXT: ]
54 // JSON-INDEX-NEXT: };
55 // JSON-INDEX-NEXT: }
56
57 // HTML-SHAPE: <h1>class Shape</h1>
58 // HTML-SHAPE: <p>Defined at line 8 of file {{.*}}Shape.h</p>
59 // HTML-SHAPE: <p> Provides a common interface for different types of shapes.</p>
60 // HTML-SHAPE: <h2 id="Functions">Functions</h2>
61 // HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">~Shape</h3>
62 // HTML-SHAPE: <p>public void ~Shape()</p>
63 // HTML-SHAPE: <p>Defined at line 13 of file {{.*}}Shape.h</p>
64 // HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
65 // HTML-SHAPE: <p>public double area()</p>
66 // HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
67 // HTML-SHAPE: <p>public double perimeter()</p>
68
69 // HTML-CALC: <h1>class Calculator</h1>
70 // HTML-CALC: <p>Defined at line 8 of file {{.*}}Calculator.h</p>
71 // HTML-CALC: <p> Provides basic arithmetic operations.</p>
72 // HTML-CALC: <h2 id="Functions">Functions</h2>
73 // HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">add</h3>
74 // HTML-CALC: <p>public int add(int a, int b)</p>
75 // HTML-CALC: <p>Defined at line 3 of file {{.*}}Calculator.cpp</p>
76 // HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">subtract</h3>
77 // HTML-CALC: <p>public int subtract(int a, int b)</p>
78 // HTML-CALC: <p>Defined at line 7 of file {{.*}}Calculator.cpp</p>
79 // HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">multiply</h3>
80 // HTML-CALC: <p>public int multiply(int a, int b)</p>
81 // HTML-CALC: <p>Defined at line 11 of file {{.*}}Calculator.cpp</p>
82 // HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">divide</h3>
83 // HTML-CALC: <p>public double divide(int a, int b)</p>
84 // HTML-CALC: <p>Defined at line 15 of file {{.*}}Calculator.cpp</p>
85
86 // HTML-RECTANGLE: <h1>class Rectangle</h1>
87 // HTML-RECTANGLE: <p>Defined at line 10 of file {{.*}}Rectangle.h</p>
88 // HTML-RECTANGLE: <p> Represents a rectangle with a given width and height.</p
89 // HTML-RECTANGLE: <p>
90 // HTML-RECTANGLE: Inherits from
91 // HTML-RECTANGLE: <a href="Shape.html">Shape</a>
92 // HTML-RECTANGLE: </p>
93 // HTML-RECTANGLE: <h2 id="Members">Members</h2>
94 // HTML-RECTANGLE: <li>private double width_</li>
95 // HTML-RECTANGLE: <li>private double height_</li>
96 // HTML-RECTANGLE: <h2 id="Functions">Functions</h2>
97 // HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">Rectangle</h3>
98 // HTML-RECTANGLE: <p>public void Rectangle(double width, double height)</p>
99 // HTML-RECTANGLE: <p>Defined at line 3 of file {{.*}}Rectangle.cpp</p>
100 // HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
101 // HTML-RECTANGLE: <p>public double area()</p>
102 // HTML-RECTANGLE: <p>Defined at line 6 of file {{.*}}Rectangle.cpp</p>
103 // HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
104 // HTML-RECTANGLE: <p>public double perimeter()</p>
105 // HTML-RECTANGLE: <p>Defined at line 10 of file {{.*}}Rectangle.cpp</p>
106
107 // HTML-CIRCLE: <h1>class Circle</h1>
108 // HTML-CIRCLE: <p>Defined at line 10 of file {{.*}}Circle.h</p>
109 // HTML-CIRCLE: <p> Represents a circle with a given radius.</p>
110 // HTML-CIRCLE: <p>
111 // HTML-CIRCLE: Inherits from
112 // HTML-CIRCLE: <a href="Shape.html">Shape</a>
113 // HTML-CIRCLE: </p>
114 // HTML-CIRCLE: <h2 id="Members">Members</h2>
115 // HTML-CIRCLE: <li>private double radius_</li>
116 // HTML-CIRCLE: <h2 id="Functions">Functions</h2>
117 // HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">Circle</h3>
118 // HTML-CIRCLE: <p>public void Circle(double radius)</p>
119 // HTML-CIRCLE: <p>Defined at line 3 of file {{.*}}Circle.cpp</p>
120 // HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
121 // HTML-CIRCLE: <p>public double area()</p>
122 // HTML-CIRCLE: <p>Defined at line 5 of file {{.*}}Circle.cpp</p>
123 // HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
124 // HTML-CIRCLE: <p>public double perimeter()</p>
125 // HTML-CIRCLE: <p>Defined at line 9 of file {{.*}}Circle.cpp</p>
126
127 // MD-CALC: # class Calculator
128 // MD-CALC: *Defined at .{{[\/]}}include{{[\/]}}Calculator.h#8*
129 // MD-CALC: **brief** A simple calculator class.
130 // MD-CALC: Provides basic arithmetic operations.
131 // MD-CALC: ## Functions
132 // MD-CALC: ### add
133 // MD-CALC: *public int add(int a, int b)*
134 // MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#3*
135 // MD-CALC: **brief** Adds two integers.
136 // MD-CALC: **a** First integer.
137 // MD-CALC: **b** Second integer.
138 // MD-CALC: **return** int The sum of a and b.
139 // MD-CALC: ### subtract
140 // MD-CALC: *public int subtract(int a, int b)*
141 // MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#7*
142 // MD-CALC: **brief** Subtracts the second integer from the first.
143 // MD-CALC: **a** First integer.
144 // MD-CALC: **b** Second integer.
145 // MD-CALC: **return** int The result of a - b.
146 // MD-CALC: ### multiply
147 // MD-CALC: *public int multiply(int a, int b)*
148 // MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#11*
149 // MD-CALC: **brief** Multiplies two integers.
150 // MD-CALC: **a** First integer.
151 // MD-CALC: **b** Second integer.
152 // MD-CALC: **return** int The product of a and b.
153 // MD-CALC: ### divide
154 // MD-CALC: *public double divide(int a, int b)*
155 // MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#15*
156 // MD-CALC: **brief** Divides the first integer by the second.
157 // MD-CALC: **a** First integer.
158 // MD-CALC: **b** Second integer.
159 // MD-CALC: **return** double The result of a / b.
160 // MD-CALC: **throw**if b is zero.
161
162 // MD-CIRCLE: # class Circle
163 // MD-CIRCLE: *Defined at .{{[\/]}}include{{[\/]}}Circle.h#10*
164 // MD-CIRCLE: **brief** Circle class derived from Shape.
165 // MD-CIRCLE: Represents a circle with a given radius.
166 // MD-CIRCLE: Inherits from Shape
167 // MD-CIRCLE: ## Members
168 // MD-CIRCLE: private double radius_
169 // MD-CIRCLE: ## Functions
170 // MD-CIRCLE: ### Circle
171 // MD-CIRCLE: *public void Circle(double radius)*
172 // MD-CIRCLE: *Defined at .{{[\/]}}src{{[\/]}}Circle.cpp#3*
173 // MD-CIRCLE: **brief** Constructs a new Circle object.
174 // MD-CIRCLE: **radius** Radius of the circle.
175 // MD-CIRCLE: ### area
176 // MD-CIRCLE: *public double area()*
177 // MD-CIRCLE: *Defined at .{{[\/]}}src{{[\/]}}Circle.cpp#5*
178 // MD-CIRCLE: **brief** Calculates the area of the circle.
179 // MD-CIRCLE: **return** double The area of the circle.
180 // MD-CIRCLE: ### perimeter
181 // MD-CIRCLE: *public double perimeter()*
182 // MD-CIRCLE: *Defined at .{{[\/]}}src{{[\/]}}Circle.cpp#9*
183 // MD-CIRCLE: **brief** Calculates the perimeter of the circle.
184 // MD-CIRCLE: **return** double The perimeter of the circle.
185
186 // MD-RECTANGLE: # class Rectangle
187 // MD-RECTANGLE: *Defined at .{{[\/]}}include{{[\/]}}Rectangle.h#10*
188 // MD-RECTANGLE: **brief** Rectangle class derived from Shape.
189 // MD-RECTANGLE: Represents a rectangle with a given width and height.
190 // MD-RECTANGLE: Inherits from Shape
191 // MD-RECTANGLE: ## Members
192 // MD-RECTANGLE: private double width_
193 // MD-RECTANGLE: private double height_
194 // MD-RECTANGLE: ## Functions
195 // MD-RECTANGLE: ### Rectangle
196 // MD-RECTANGLE: *public void Rectangle(double width, double height)*
197 // MD-RECTANGLE: *Defined at .{{[\/]}}src{{[\/]}}Rectangle.cpp#3*
198 // MD-RECTANGLE: **brief** Constructs a new Rectangle object.
199 // MD-RECTANGLE: **width** Width of the rectangle.
200 // MD-RECTANGLE: **height** Height of the rectangle.
201 // MD-RECTANGLE: ### area
202 // MD-RECTANGLE: *public double area()*
203 // MD-RECTANGLE: *Defined at .{{[\/]}}src{{[\/]}}Rectangle.cpp#6*
204 // MD-RECTANGLE: **brief** Calculates the area of the rectangle.
205 // MD-RECTANGLE: **return** double The area of the rectangle.
206 // MD-RECTANGLE: ### perimeter
207 // MD-RECTANGLE: *public double perimeter()*
208 // MD-RECTANGLE: *Defined at .{{[\/]}}src{{[\/]}}Rectangle.cpp#10*
209 // MD-RECTANGLE: **brief** Calculates the perimeter of the rectangle.
210 // MD-RECTANGLE: **return** double The perimeter of the rectangle.
211
212 // MD-SHAPE: # class Shape
213 // MD-SHAPE: *Defined at .{{[\/]}}include{{[\/]}}Shape.h#8*
214 // MD-SHAPE: **brief** Abstract base class for shapes.
215 // MD-SHAPE: Provides a common interface for different types of shapes.
216 // MD-SHAPE: ## Functions
217 // MD-SHAPE: ### ~Shape
218 // MD-SHAPE: *public void ~Shape()*
219 // MD-SHAPE: *Defined at .{{[\/]}}include{{[\/]}}Shape.h#13*
220 // MD-SHAPE: **brief** Virtual destructor.
221 // MD-SHAPE: ### area
222 // MD-SHAPE: *public double area()*
223 // MD-SHAPE: **brief** Calculates the area of the shape.
224 // MD-SHAPE: **return** double The area of the shape.
225 // MD-SHAPE: ### perimeter
226 // MD-SHAPE: *public double perimeter()*
227 // MD-SHAPE: **brief** Calculates the perimeter of the shape.
228 // MD-SHAPE: **return** double The perimeter of the shape.
229
230 // MD-ALL-FILES: # All Files
231 // MD-ALL-FILES: ## [GlobalNamespace](GlobalNamespace{{[\/]}}index.md)
232
233 // MD-INDEX: # C/C++ Reference
234 // MD-INDEX: * Namespace: [GlobalNamespace](GlobalNamespace)