Skip to content

Commit 93b7c1b

Browse files
authored
[clang-doc] Add testing without --repository for HTML documentation (#131894)
#131697 reported a crash when --repository was unused, so make sure we test the project in both configurations.
1 parent 58027fa commit 93b7c1b

File tree

1 file changed

+109
-73
lines changed

1 file changed

+109
-73
lines changed

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

Lines changed: 109 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
// RUN: rm -rf %t && mkdir -p %t/docs %t/build
22
// 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 --repository=https://repository.com
3+
// RUN: clang-doc --format=html --output=%t/docs --executor=all-TUs %t/build/compile_commands.json
44
// 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
5+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Shape.html -check-prefixes=HTML-SHAPE,SHAPE-NO-REPOSITORY
6+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Calculator.html -check-prefixes=HTML-CALC,CALC-NO-REPOSITORY
7+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Rectangle.html -check-prefixes=HTML-RECTANGLE,RECTANGLE-NO-REPOSITORY
8+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Circle.html -check-prefixes=HTML-CIRCLE,CIRCLE-NO-REPOSITORY
9+
10+
// RUN: clang-doc --format=html --output=%t/docs --executor=all-TUs %t/build/compile_commands.json --repository=https://repository.com
11+
// RUN: FileCheck %s -input-file=%t/docs/index_json.js -check-prefixes=JSON-INDEX
12+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Shape.html -check-prefixes=HTML-SHAPE,SHAPE-REPOSITORY
13+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Calculator.html -check-prefixes=HTML-CALC,CALC-REPOSITORY
14+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Rectangle.html -check-prefixes=HTML-RECTANGLE,RECTANGLE-REPOSITORY
15+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Circle.html -check-prefixes=HTML-CIRCLE,CIRCLE-REPOSITORY
16+
917

1018
// JSON-INDEX: async function LoadIndex() {
1119
// JSON-INDEX-NEXT: return{
@@ -55,12 +63,13 @@
5563
// JSON-INDEX-NEXT: }
5664

5765
// HTML-SHAPE: <h1>class Shape</h1>
58-
// HTML-SHAPE-NEXT: <p>
59-
// HTML-SHAPE-NEXT: Defined at line
60-
// HTML-SHAPE-NEXT: <a href="https://repository.com/./include/Shape.h#8">8</a>
61-
// HTML-SHAPE-NEXT: of file
62-
// HTML-SHAPE-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
63-
// HTML-SHAPE-NEXT: </p>
66+
// SHAPE-NO-REPOSITORY: <p>Defined at line 8 of file .{{.}}include{{.}}Shape.h</p>
67+
// SHAPE-REPOSITORY: <p>
68+
// SHAPE-REPOSITORY-NEXT: Defined at line
69+
// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h#8">8</a>
70+
// SHAPE-REPOSITORY-NEXT: of file
71+
// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
72+
// SHAPE-REPOSITORY-NEXT: </p>
6473
// HTML-SHAPE: <div>brief</div>
6574
// HTML-SHAPE: <p> Abstract base class for shapes.</p>
6675
// HTML-SHAPE: <p> Provides a common interface for different types of shapes.</p>
@@ -77,60 +86,72 @@
7786
// HTML-SHAPE: <p> double The perimeter of the shape.</p>
7887
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">~Shape</h3>
7988
// HTML-SHAPE: <p>public void ~Shape()</p>
80-
// HTML-SHAPE: Defined at line
81-
// HTML-SHAPE-NEXT: <a href="https://repository.com/./include/Shape.h#13">13</a>
82-
// HTML-SHAPE-NEXT: of file
83-
// HTML-SHAPE-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
89+
90+
// SHAPE-NO-REPOSITORY: Defined at line 13 of file .{{.}}include{{.}}Shape.h
91+
// SHAPE-REPOSITORY: Defined at line
92+
// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h#13">13</a>
93+
// SHAPE-REPOSITORY-NEXT: of file
94+
// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
95+
8496
// HTML-SHAPE: <div>brief</div>
8597
// HTML-SHAPE: <p> Virtual destructor.</p>
8698

8799
// HTML-CALC: <h1>class Calculator</h1>
88-
// HTML-CALC-NEXT: <p>
89-
// HTML-CALC-NEXT: Defined at line
90-
// HTML-CALC-NEXT: <a href="https://repository.com/./include/Calculator.h#8">8</a>
91-
// HTML-CALC-NEXT: of file
92-
// HTML-CALC-NEXT: <a href="https://repository.com/./include/Calculator.h">Calculator.h</a>
93-
// HTML-CALC-NEXT: </p>
100+
// CALC-NO-REPOSITORY: <p>Defined at line 8 of file .{{.}}include{{.}}Calculator.h</p>
101+
// CALC-REPOSITORY: <p>
102+
// CALC-REPOSITORY-NEXT: Defined at line
103+
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./include/Calculator.h#8">8</a>
104+
// CALC-REPOSITORY-NEXT: of file
105+
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./include/Calculator.h">Calculator.h</a>
106+
// CALC-REPOSITORY-NEXT: </p>
94107
// HTML-CALC: <div>brief</div>
95108
// HTML-CALC: <p> A simple calculator class.</p>
96109
// HTML-CALC: <p> Provides basic arithmetic operations.</p>
97110
// HTML-CALC: <h2 id="Functions">Functions</h2>
98111
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">add</h3>
99112
// HTML-CALC: <p>public int add(int a, int b)</p>
100-
// HTML-CALC: Defined at line
101-
// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp#3">3</a>
102-
// HTML-CALC-NEXT: of file
103-
// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
113+
// CALC-NO-REPOSITORY: Defined at line 3 of file .{{.}}src{{.}}Calculator.cpp
114+
// CALC-REPOSITORY: Defined at line
115+
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#3">3</a>
116+
// CALC-REPOSITORY-NEXT: of file
117+
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
118+
104119
// HTML-CALC: <div>brief</div>
105120
// HTML-CALC: <p> Adds two integers.</p>
106121
// HTML-CALC: <div>return</div>
107122
// HTML-CALC: <p> int The sum of a and b.</p>
108123
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">subtract</h3>
109124
// HTML-CALC: <p>public int subtract(int a, int b)</p>
110-
// HTML-CALC: Defined at line
111-
// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp#7">7</a>
112-
// HTML-CALC-NEXT: of file
113-
// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
125+
// CALC-NO-REPOSITORY: Defined at line 7 of file .{{.}}src{{.}}Calculator.cpp
126+
// CALC-REPOSITORY: Defined at line
127+
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#7">7</a>
128+
// CALC-REPOSITORY-NEXT: of file
129+
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
130+
114131
// HTML-CALC: <div>brief</div>
115132
// HTML-CALC: <p> Subtracts the second integer from the first.</p>
116133
// HTML-CALC: <div>return</div>
117134
// HTML-CALC: <p> int The result of a - b.</p>
118135
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">multiply</h3>
119136
// HTML-CALC: <p>public int multiply(int a, int b)</p>
120-
// HTML-CALC: Defined at line
121-
// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp#11">11</a>
122-
// HTML-CALC-NEXT: of file
123-
// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
137+
// CALC-NO-REPOSITORY: Defined at line 11 of file .{{.}}src{{.}}Calculator.cpp
138+
// CALC-REPOSITORY: Defined at line
139+
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#11">11</a>
140+
// CALC-REPOSITORY-NEXT: of file
141+
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
142+
124143
// HTML-CALC: <div>brief</div>
125144
// HTML-CALC: <p> Multiplies two integers.</p>
126145
// HTML-CALC: <div>return</div>
127146
// HTML-CALC: <p> int The product of a and b.</p>
128147
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">divide</h3>
129148
// HTML-CALC: <p>public double divide(int a, int b)</p>
130-
// HTML-CALC: Defined at line
131-
// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp#15">15</a>
132-
// HTML-CALC-NEXT: of file
133-
// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
149+
// CALC-NO-REPOSITORY: Defined at line 15 of file .{{.}}src{{.}}Calculator.cpp
150+
// CALC-REPOSITORY: Defined at line
151+
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#15">15</a>
152+
// CALC-REPOSITORY-NEXT: of file
153+
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
154+
134155
// HTML-CALC: <div>brief</div>
135156
// HTML-CALC: <p> Divides the first integer by the second.</p>
136157
// HTML-CALC: <div>return</div>
@@ -139,12 +160,14 @@
139160
// HTML-CALC: <p>if b is zero.</p>
140161

141162
// HTML-RECTANGLE: <h1>class Rectangle</h1>
142-
// HTML-RECTANGLE-NEXT: <p>
143-
// HTML-RECTANGLE-NEXT: Defined at line
144-
// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./include/Rectangle.h#10">10</a>
145-
// HTML-RECTANGLE-NEXT: of file
146-
// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./include/Rectangle.h">Rectangle.h</a>
147-
// HTML-RECTANGLE-NEXT: </p>
163+
// RECTANGLE-NO-REPOSITORY: <p>Defined at line 10 of file .{{.}}include{{.}}Rectangle.h</p>
164+
// RECTANGLE-REPOSITORY: <p>
165+
// RECTANGLE-REPOSITORY-NEXT: Defined at line
166+
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Rectangle.h#10">10</a>
167+
// RECTANGLE-REPOSITORY-NEXT: of file
168+
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Rectangle.h">Rectangle.h</a>
169+
// RECTANGLE-REPOSITORY-NEXT: </p>
170+
148171
// HTML-RECTANGLE: <p> Represents a rectangle with a given width and height.</p>
149172
// HTML-RECTANGLE: <p>
150173
// HTML-RECTANGLE: Inherits from
@@ -158,40 +181,47 @@
158181
// HTML-RECTANGLE: <h2 id="Functions">Functions</h2>
159182
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">Rectangle</h3>
160183
// HTML-RECTANGLE: <p>public void Rectangle(double width, double height)</p>
161-
// HTML-RECTANGLE: Defined at line
162-
// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#3">3</a>
163-
// HTML-RECTANGLE-NEXT: of file
164-
// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
184+
// RECTANGLE-NO-REPOSITORY: Defined at line 3 of file .{{.}}src{{.}}Rectangle.cpp
185+
// RECTANGLE-REPOSITORY: Defined at line
186+
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#3">3</a>
187+
// RECTANGLE-REPOSITORY-NEXT: of file
188+
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
189+
165190
// HTML-RECTANGLE: <div>brief</div>
166191
// HTML-RECTANGLE: <p> Constructs a new Rectangle object.</p>
167192
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
168193
// HTML-RECTANGLE: <p>public double area()</p>
169-
// HTML-RECTANGLE: Defined at line
170-
// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#6">6</a>
171-
// HTML-RECTANGLE-NEXT: of file
172-
// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
194+
// RECTANGLE-NO-REPOSITORY: Defined at line 6 of file .{{.}}src{{.}}Rectangle.cpp
195+
// RECTANGLE-REPOSITORY: Defined at line
196+
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#6">6</a>
197+
// RECTANGLE-REPOSITORY-NEXT: of file
198+
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
199+
173200
// HTML-RECTANGLE: <div>brief</div>
174201
// HTML-RECTANGLE: <p> Calculates the area of the rectangle.</p>
175202
// HTML-RECTANGLE: <div>return</div>
176203
// HTML-RECTANGLE: <p> double The area of the rectangle.</p>
177204
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
178205
// HTML-RECTANGLE: <p>public double perimeter()</p>
179-
// HTML-RECTANGLE: Defined at line
180-
// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#10">10</a>
181-
// HTML-RECTANGLE-NEXT: of file
182-
// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
206+
// RECTANGLE-NO-REPOSITORY: Defined at line 10 of file .{{.}}src{{.}}Rectangle.cpp
207+
// RECTANGLE-REPOSITORY: Defined at line
208+
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#10">10</a>
209+
// RECTANGLE-REPOSITORY-NEXT: of file
210+
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
183211
// HTML-RECTANGLE: <div>brief</div>
184212
// HTML-RECTANGLE: <p> Calculates the perimeter of the rectangle.</p>
185213
// HTML-RECTANGLE: <div>return</div>
186214
// HTML-RECTANGLE: <p> double The perimeter of the rectangle.</p>
187215

188216
// HTML-CIRCLE: <h1>class Circle</h1>
189-
// HTML-CIRCLE-NEXT: <p>
190-
// HTML-CIRCLE-NEXT: Defined at line
191-
// HTML-CIRCLE-NEXT: <a href="https://repository.com/./include/Circle.h#10">10</a>
192-
// HTML-CIRCLE-NEXT: of file
193-
// HTML-CIRCLE-NEXT: <a href="https://repository.com/./include/Circle.h">Circle.h</a>
194-
// HTML-CIRCLE-NEXT: </p>
217+
// CIRCLE-NO-REPOSITORY: <p>Defined at line 10 of file .{{.}}include{{.}}Circle.h</p>
218+
// CIRCLE-REPOSITORY: <p>
219+
// CIRCLE-REPOSITORY-NEXT: Defined at line
220+
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Circle.h#10">10</a>
221+
// CIRCLE-REPOSITORY-NEXT: of file
222+
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Circle.h">Circle.h</a>
223+
// CIRCLE-REPOSITORY-NEXT: </p>
224+
195225
// HTML-CIRCLE: <div>brief</div>
196226
// HTML-CIRCLE: <p> Circle class derived from Shape.</p>
197227
// HTML-CIRCLE: <p> Represents a circle with a given radius.</p>
@@ -205,28 +235,34 @@
205235
// HTML-CIRCLE: <h2 id="Functions">Functions</h2>
206236
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">Circle</h3>
207237
// HTML-CIRCLE: <p>public void Circle(double radius)</p>
208-
// HTML-CIRCLE: Defined at line
209-
// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp#3">3</a>
210-
// HTML-CIRCLE-NEXT: of file
211-
// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
238+
// CIRCLE-NO-REPOSITORY: Defined at line 3 of file .{{.}}src{{.}}Circle.cpp
239+
// CIRCLE-REPOSITORY: Defined at line
240+
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp#3">3</a>
241+
// CIRCLE-REPOSITORY-NEXT: of file
242+
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
243+
212244
// HTML-CIRCLE: <div>brief</div>
213245
// HTML-CIRCLE: <p> Constructs a new Circle object.</p>
214246
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
215247
// HTML-CIRCLE: <p>public double area()</p>
216-
// HTML-CIRCLE: Defined at line
217-
// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp#5">5</a>
218-
// HTML-CIRCLE-NEXT: of file
219-
// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
248+
// CIRCLE-NO-REPOSITORY: Defined at line 5 of file .{{.}}src{{.}}Circle.cpp
249+
// CIRCLE-REPOSITORY: Defined at line
250+
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp#5">5</a>
251+
// CIRCLE-REPOSITORY-NEXT: of file
252+
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
253+
220254
// HTML-CIRCLE: <div>brief</div>
221255
// HTML-CIRCLE: <p> Calculates the area of the circle.</p>
222256
// HTML-CIRCLE: <div>return</div>
223257
// HTML-CIRCLE: <p> double The area of the circle.</p>
224258
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
225259
// HTML-CIRCLE: <p>public double perimeter()</p>
226-
// HTML-CIRCLE: Defined at line
227-
// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp#9">9</a>
228-
// HTML-CIRCLE-NEXT: of file
229-
// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
260+
// CIRCLE-NO-REPOSITORY: Defined at line 9 of file .{{.}}src{{.}}Circle.cpp
261+
// CIRCLE-REPOSITORY: Defined at line
262+
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp#9">9</a>
263+
// CIRCLE-REPOSITORY-NEXT: of file
264+
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
265+
230266
// HTML-CIRCLE: <div>brief</div>
231267
// HTML-CIRCLE: <p> Calculates the perimeter of the circle.</p>
232268
// HTML-CIRCLE: <div>return</div>

0 commit comments

Comments
 (0)