Skip to content

Commit 3205e4d

Browse files
Add new ui tests for rustdoc::bare_urls
1 parent 5a36fe2 commit 3205e4d

File tree

3 files changed

+97
-1
lines changed

3 files changed

+97
-1
lines changed

tests/rustdoc-ui/lints/bare-urls.fixed

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,17 @@ pub mod foo {
6868
/// https://somewhere.com/a?hello=12&bye=11#xyz
6969
pub fn bar() {}
7070
}
71+
72+
/// <https://bloob.blob>
73+
//~^ ERROR this URL is not a hyperlink
74+
/// [ <https://bloob.blob> ]
75+
//~^ ERROR this URL is not a hyperlink
76+
/// [ <https://bloob.blob>]
77+
//~^ ERROR this URL is not a hyperlink
78+
/// [<https://bloob.blob> ]
79+
//~^ ERROR this URL is not a hyperlink
80+
/// [<https://bloob.blob>
81+
//~^ ERROR this URL is not a hyperlink
82+
/// <https://bloob.blob>]
83+
//~^ ERROR this URL is not a hyperlink
84+
pub fn lint_with_brackets() {}

tests/rustdoc-ui/lints/bare-urls.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,17 @@ pub mod foo {
6868
/// https://somewhere.com/a?hello=12&bye=11#xyz
6969
pub fn bar() {}
7070
}
71+
72+
/// [https://bloob.blob]
73+
//~^ ERROR this URL is not a hyperlink
74+
/// [ https://bloob.blob ]
75+
//~^ ERROR this URL is not a hyperlink
76+
/// [ https://bloob.blob]
77+
//~^ ERROR this URL is not a hyperlink
78+
/// [https://bloob.blob ]
79+
//~^ ERROR this URL is not a hyperlink
80+
/// [https://bloob.blob
81+
//~^ ERROR this URL is not a hyperlink
82+
/// https://bloob.blob]
83+
//~^ ERROR this URL is not a hyperlink
84+
pub fn lint_with_brackets() {}

tests/rustdoc-ui/lints/bare-urls.stderr

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,73 @@ help: use an automatic link instead
243243
LL | #[doc = "<https://example.com/raw>"]
244244
| + +
245245

246-
error: aborting due to 20 previous errors
246+
error: this URL is not a hyperlink
247+
--> $DIR/bare-urls.rs:72:5
248+
|
249+
LL | /// [https://bloob.blob]
250+
| ^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://bloob.blob>`
251+
|
252+
= note: bare URLs are not automatically turned into clickable links
253+
254+
error: this URL is not a hyperlink
255+
--> $DIR/bare-urls.rs:74:7
256+
|
257+
LL | /// [ https://bloob.blob ]
258+
| ^^^^^^^^^^^^^^^^^^
259+
|
260+
= note: bare URLs are not automatically turned into clickable links
261+
help: use an automatic link instead
262+
|
263+
LL | /// [ <https://bloob.blob> ]
264+
| + +
265+
266+
error: this URL is not a hyperlink
267+
--> $DIR/bare-urls.rs:76:7
268+
|
269+
LL | /// [ https://bloob.blob]
270+
| ^^^^^^^^^^^^^^^^^^
271+
|
272+
= note: bare URLs are not automatically turned into clickable links
273+
help: use an automatic link instead
274+
|
275+
LL | /// [ <https://bloob.blob>]
276+
| + +
277+
278+
error: this URL is not a hyperlink
279+
--> $DIR/bare-urls.rs:78:6
280+
|
281+
LL | /// [https://bloob.blob ]
282+
| ^^^^^^^^^^^^^^^^^^
283+
|
284+
= note: bare URLs are not automatically turned into clickable links
285+
help: use an automatic link instead
286+
|
287+
LL | /// [<https://bloob.blob> ]
288+
| + +
289+
290+
error: this URL is not a hyperlink
291+
--> $DIR/bare-urls.rs:80:6
292+
|
293+
LL | /// [https://bloob.blob
294+
| ^^^^^^^^^^^^^^^^^^
295+
|
296+
= note: bare URLs are not automatically turned into clickable links
297+
help: use an automatic link instead
298+
|
299+
LL | /// [<https://bloob.blob>
300+
| + +
301+
302+
error: this URL is not a hyperlink
303+
--> $DIR/bare-urls.rs:82:5
304+
|
305+
LL | /// https://bloob.blob]
306+
| ^^^^^^^^^^^^^^^^^^
307+
|
308+
= note: bare URLs are not automatically turned into clickable links
309+
help: use an automatic link instead
310+
|
311+
LL | /// <https://bloob.blob>]
312+
| + +
313+
314+
error: aborting due to 26 previous errors
247315

0 commit comments

Comments
 (0)