Skip to content

Commit 2069d3e

Browse files
Update doc alias ui tests
1 parent bbbefa3 commit 2069d3e

File tree

4 files changed

+148
-24
lines changed

4 files changed

+148
-24
lines changed
+13-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
#![crate_type = "lib"]
22

33
#[doc(alias = "foo")] // ok!
4+
#[doc(alias("bar", "baz"))] // ok!
45
pub struct Bar;
56

67
#[doc(alias)] //~ ERROR
78
#[doc(alias = 0)] //~ ERROR
8-
#[doc(alias("bar"))] //~ ERROR
99
#[doc(alias = "\"")] //~ ERROR
1010
#[doc(alias = "\n")] //~ ERROR
1111
#[doc(alias = "
1212
")] //~^ ERROR
1313
#[doc(alias = "\t")] //~ ERROR
1414
#[doc(alias = " hello")] //~ ERROR
1515
#[doc(alias = "hello ")] //~ ERROR
16+
#[doc(alias = "")] //~ ERROR
1617
pub struct Foo;
18+
19+
#[doc(alias(0))] //~ ERROR
20+
#[doc(alias("\""))] //~ ERROR
21+
#[doc(alias("\n"))] //~ ERROR
22+
#[doc(alias("
23+
"))] //~^ ERROR
24+
#[doc(alias("\t"))] //~ ERROR
25+
#[doc(alias(" hello"))] //~ ERROR
26+
#[doc(alias("hello "))] //~ ERROR
27+
#[doc(alias(""))] //~ ERROR
28+
pub struct Foo2;

src/test/rustdoc-ui/check-doc-alias-attr.stderr

+61-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
error: doc alias attribute expects a string: #[doc(alias = "a")]
2-
--> $DIR/check-doc-alias-attr.rs:6:7
1+
error: doc alias attribute expects a string `#[doc(alias = "a")]` or a list of strings `#[doc(alias("a", "b"))]`
2+
--> $DIR/check-doc-alias-attr.rs:7:7
33
|
44
LL | #[doc(alias)]
55
| ^^^^^
66

7-
error: doc alias attribute expects a string: #[doc(alias = "a")]
8-
--> $DIR/check-doc-alias-attr.rs:7:7
7+
error: doc alias attribute expects a string `#[doc(alias = "a")]` or a list of strings `#[doc(alias("a", "b"))]`
8+
--> $DIR/check-doc-alias-attr.rs:8:7
99
|
1010
LL | #[doc(alias = 0)]
1111
| ^^^^^^^^^
1212

13-
error: doc alias attribute expects a string: #[doc(alias = "a")]
14-
--> $DIR/check-doc-alias-attr.rs:8:7
15-
|
16-
LL | #[doc(alias("bar"))]
17-
| ^^^^^^^^^^^^
18-
1913
error: '\"' character isn't allowed in `#[doc(alias = "...")]`
2014
--> $DIR/check-doc-alias-attr.rs:9:15
2115
|
@@ -54,5 +48,61 @@ error: `#[doc(alias = "...")]` cannot start or end with ' '
5448
LL | #[doc(alias = "hello ")]
5549
| ^^^^^^^^
5650

57-
error: aborting due to 9 previous errors
51+
error: `#[doc(alias = "...")]` attribute cannot have empty value
52+
--> $DIR/check-doc-alias-attr.rs:16:15
53+
|
54+
LL | #[doc(alias = "")]
55+
| ^^
56+
57+
error: `#[doc(alias("a"))]` expects string literals
58+
--> $DIR/check-doc-alias-attr.rs:19:13
59+
|
60+
LL | #[doc(alias(0))]
61+
| ^
62+
63+
error: '\"' character isn't allowed in `#[doc(alias("..."))]`
64+
--> $DIR/check-doc-alias-attr.rs:20:13
65+
|
66+
LL | #[doc(alias("\""))]
67+
| ^^^^
68+
69+
error: '\n' character isn't allowed in `#[doc(alias("..."))]`
70+
--> $DIR/check-doc-alias-attr.rs:21:13
71+
|
72+
LL | #[doc(alias("\n"))]
73+
| ^^^^
74+
75+
error: '\n' character isn't allowed in `#[doc(alias("..."))]`
76+
--> $DIR/check-doc-alias-attr.rs:22:13
77+
|
78+
LL | #[doc(alias("
79+
| _____________^
80+
LL | | "))]
81+
| |_^
82+
83+
error: '\t' character isn't allowed in `#[doc(alias("..."))]`
84+
--> $DIR/check-doc-alias-attr.rs:24:13
85+
|
86+
LL | #[doc(alias("\t"))]
87+
| ^^^^
88+
89+
error: `#[doc(alias("..."))]` cannot start or end with ' '
90+
--> $DIR/check-doc-alias-attr.rs:25:13
91+
|
92+
LL | #[doc(alias(" hello"))]
93+
| ^^^^^^^^
94+
95+
error: `#[doc(alias("..."))]` cannot start or end with ' '
96+
--> $DIR/check-doc-alias-attr.rs:26:13
97+
|
98+
LL | #[doc(alias("hello "))]
99+
| ^^^^^^^^
100+
101+
error: `#[doc(alias("..."))]` attribute cannot have empty value
102+
--> $DIR/check-doc-alias-attr.rs:27:13
103+
|
104+
LL | #[doc(alias(""))]
105+
| ^^
106+
107+
error: aborting due to 17 previous errors
58108

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
#![crate_type = "lib"]
22

33
#[doc(alias = "foo")] // ok!
4+
#[doc(alias("bar", "baz"))] // ok!
45
pub struct Bar;
56

67
#[doc(alias)] //~ ERROR
78
#[doc(alias = 0)] //~ ERROR
8-
#[doc(alias("bar"))] //~ ERROR
99
#[doc(alias = "\"")] //~ ERROR
1010
#[doc(alias = "\n")] //~ ERROR
1111
#[doc(alias = "
1212
")] //~^ ERROR
1313
#[doc(alias = "\t")] //~ ERROR
1414
#[doc(alias = " hello")] //~ ERROR
1515
#[doc(alias = "hello ")] //~ ERROR
16+
#[doc(alias = "")] //~ ERROR
1617
pub struct Foo;
18+
19+
#[doc(alias(0))] //~ ERROR
20+
#[doc(alias("\""))] //~ ERROR
21+
#[doc(alias("\n"))] //~ ERROR
22+
#[doc(alias("
23+
"))] //~^ ERROR
24+
#[doc(alias("\t"))] //~ ERROR
25+
#[doc(alias(" hello"))] //~ ERROR
26+
#[doc(alias("hello "))] //~ ERROR
27+
#[doc(alias(""))] //~ ERROR
28+
pub struct Foo2;

src/test/ui/rustdoc/check-doc-alias-attr.stderr

+61-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
error: doc alias attribute expects a string: #[doc(alias = "a")]
2-
--> $DIR/check-doc-alias-attr.rs:6:7
1+
error: doc alias attribute expects a string `#[doc(alias = "a")]` or a list of strings `#[doc(alias("a", "b"))]`
2+
--> $DIR/check-doc-alias-attr.rs:7:7
33
|
44
LL | #[doc(alias)]
55
| ^^^^^
66

7-
error: doc alias attribute expects a string: #[doc(alias = "a")]
8-
--> $DIR/check-doc-alias-attr.rs:7:7
7+
error: doc alias attribute expects a string `#[doc(alias = "a")]` or a list of strings `#[doc(alias("a", "b"))]`
8+
--> $DIR/check-doc-alias-attr.rs:8:7
99
|
1010
LL | #[doc(alias = 0)]
1111
| ^^^^^^^^^
1212

13-
error: doc alias attribute expects a string: #[doc(alias = "a")]
14-
--> $DIR/check-doc-alias-attr.rs:8:7
15-
|
16-
LL | #[doc(alias("bar"))]
17-
| ^^^^^^^^^^^^
18-
1913
error: '\"' character isn't allowed in `#[doc(alias = "...")]`
2014
--> $DIR/check-doc-alias-attr.rs:9:15
2115
|
@@ -54,5 +48,61 @@ error: `#[doc(alias = "...")]` cannot start or end with ' '
5448
LL | #[doc(alias = "hello ")]
5549
| ^^^^^^^^
5650

57-
error: aborting due to 9 previous errors
51+
error: `#[doc(alias = "...")]` attribute cannot have empty value
52+
--> $DIR/check-doc-alias-attr.rs:16:15
53+
|
54+
LL | #[doc(alias = "")]
55+
| ^^
56+
57+
error: `#[doc(alias("a"))]` expects string literals
58+
--> $DIR/check-doc-alias-attr.rs:19:13
59+
|
60+
LL | #[doc(alias(0))]
61+
| ^
62+
63+
error: '\"' character isn't allowed in `#[doc(alias("..."))]`
64+
--> $DIR/check-doc-alias-attr.rs:20:13
65+
|
66+
LL | #[doc(alias("\""))]
67+
| ^^^^
68+
69+
error: '\n' character isn't allowed in `#[doc(alias("..."))]`
70+
--> $DIR/check-doc-alias-attr.rs:21:13
71+
|
72+
LL | #[doc(alias("\n"))]
73+
| ^^^^
74+
75+
error: '\n' character isn't allowed in `#[doc(alias("..."))]`
76+
--> $DIR/check-doc-alias-attr.rs:22:13
77+
|
78+
LL | #[doc(alias("
79+
| _____________^
80+
LL | | "))]
81+
| |_^
82+
83+
error: '\t' character isn't allowed in `#[doc(alias("..."))]`
84+
--> $DIR/check-doc-alias-attr.rs:24:13
85+
|
86+
LL | #[doc(alias("\t"))]
87+
| ^^^^
88+
89+
error: `#[doc(alias("..."))]` cannot start or end with ' '
90+
--> $DIR/check-doc-alias-attr.rs:25:13
91+
|
92+
LL | #[doc(alias(" hello"))]
93+
| ^^^^^^^^
94+
95+
error: `#[doc(alias("..."))]` cannot start or end with ' '
96+
--> $DIR/check-doc-alias-attr.rs:26:13
97+
|
98+
LL | #[doc(alias("hello "))]
99+
| ^^^^^^^^
100+
101+
error: `#[doc(alias("..."))]` attribute cannot have empty value
102+
--> $DIR/check-doc-alias-attr.rs:27:13
103+
|
104+
LL | #[doc(alias(""))]
105+
| ^^
106+
107+
error: aborting due to 17 previous errors
58108

0 commit comments

Comments
 (0)