Skip to content

Commit 2b518ac

Browse files
committed
rustdoc: test count of item contents when hidden
1 parent ffbc40f commit 2b518ac

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

src/test/rustdoc/toggle-item-contents.rs

+38-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub struct PubStruct {
99

1010
// @has 'toggle_item_contents/struct.BigPubStruct.html'
1111
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
12-
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show fields'
12+
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 13 fields'
1313
pub struct BigPubStruct {
1414
pub a: usize,
1515
pub b: usize,
@@ -28,7 +28,7 @@ pub struct BigPubStruct {
2828

2929
// @has 'toggle_item_contents/union.BigUnion.html'
3030
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
31-
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show fields'
31+
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 13 fields'
3232
pub union BigUnion {
3333
pub a: usize,
3434
pub b: usize,
@@ -63,7 +63,7 @@ pub struct PrivStruct {
6363

6464
// @has 'toggle_item_contents/enum.Enum.html'
6565
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
66-
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show fields'
66+
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 2 fields'
6767
pub enum Enum {
6868
A, B, C,
6969
D {
@@ -72,9 +72,19 @@ pub enum Enum {
7272
}
7373
}
7474

75+
// @has 'toggle_item_contents/enum.EnumStructVariant.html'
76+
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
77+
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 1 field'
78+
pub enum EnumStructVariant {
79+
A, B, C,
80+
D {
81+
a: u8,
82+
}
83+
}
84+
7585
// @has 'toggle_item_contents/enum.LargeEnum.html'
7686
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
77-
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show variants'
87+
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 13 variants'
7888
pub enum LargeEnum {
7989
A, B, C, D, E, F(u8), G, H, I, J, K, L, M
8090
}
@@ -90,7 +100,7 @@ pub trait Trait {
90100

91101
// @has 'toggle_item_contents/trait.GinormousTrait.html'
92102
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
93-
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show associated items'
103+
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 16 associated items'
94104
pub trait GinormousTrait {
95105
type A;
96106
type B;
@@ -113,7 +123,7 @@ pub trait GinormousTrait {
113123

114124
// @has 'toggle_item_contents/trait.HugeTrait.html'
115125
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
116-
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show associated constants and methods'
126+
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 12 associated constants and 2 methods'
117127
pub trait HugeTrait {
118128
type A;
119129
const M: usize = 1;
@@ -133,9 +143,30 @@ pub trait HugeTrait {
133143
fn bar();
134144
}
135145

146+
// @has 'toggle_item_contents/trait.GiganticTrait.html'
147+
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
148+
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 1 associated constant and 1 method'
149+
pub trait GiganticTrait {
150+
type A;
151+
type B;
152+
type C;
153+
type D;
154+
type E;
155+
type F;
156+
type G;
157+
type H;
158+
type I;
159+
type J;
160+
type K;
161+
type L;
162+
const M: usize = 1;
163+
#[must_use]
164+
fn foo();
165+
}
166+
136167
// @has 'toggle_item_contents/trait.BigTrait.html'
137168
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
138-
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show methods'
169+
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 14 methods'
139170
pub trait BigTrait {
140171
type A;
141172
#[must_use]

0 commit comments

Comments
 (0)