Skip to content

Commit 0147ce7

Browse files
committed
Update tests for rustdoc headers patch
1 parent 458e721 commit 0147ce7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+201
-196
lines changed

src/test/rustdoc-gui/font-weight.goml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ goto: file://|DOC_PATH|/lib2/struct.Foo.html
22
// This test checks that the font weight is correctly applied.
33
assert-css: ("//*[@class='docblock type-decl']//a[text()='Alias']", {"font-weight": "400"})
44
assert-css: ("//*[@class='structfield small-section-header']//a[text()='Alias']", {"font-weight": "400"})
5-
assert-css: ("#method\.a_method > code", {"font-weight": "600"})
6-
assert-css: ("#associatedtype\.X > code", {"font-weight": "600"})
7-
assert-css: ("#associatedconstant\.Y > code", {"font-weight": "600"})
5+
assert-css: ("#method\.a_method > .code-header", {"font-weight": "600"})
6+
assert-css: ("#associatedtype\.X > .code-header", {"font-weight": "600"})
7+
assert-css: ("#associatedconstant\.Y > .code-header", {"font-weight": "600"})
88

99
goto: file://|DOC_PATH|/test_docs/type.SomeType.html
1010
assert-css: (".top-doc .docblock p", {"font-weight": "400"}, ALL)

src/test/rustdoc-gui/implementors.goml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ assert-count: ("#implementors-list > .impl", 2)
88
assert: ("#implementors-list > .impl:nth-child(1) > a.anchor")
99
assert-attribute: ("#implementors-list > .impl:nth-child(1)", {"id": "impl-Whatever"})
1010
assert-attribute: ("#implementors-list > .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"})
11-
assert: "#implementors-list > .impl:nth-child(1) > code.in-band"
11+
assert: "#implementors-list > .impl:nth-child(1) > .code-header.in-band"
1212

1313
assert: ("#implementors-list > .impl:nth-child(2) > a.anchor")
1414
assert-attribute: ("#implementors-list > .impl:nth-child(2)", {"id": "impl-Whatever-1"})
1515
assert-attribute: ("#implementors-list > .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"})
16-
assert: "#implementors-list > .impl:nth-child(2) > code.in-band"
16+
assert: "#implementors-list > .impl:nth-child(2) > .code-header.in-band"

src/test/rustdoc/assoc-consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub trait Foo {
1313
pub struct Bar;
1414

1515
impl Foo for Bar {
16-
// @has assoc_consts/struct.Bar.html '//code' 'impl Foo for Bar'
16+
// @has assoc_consts/struct.Bar.html '//h3' 'impl Foo for Bar'
1717
// @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize'
1818
const FOO: usize = 12;
1919
// @has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool'
@@ -77,7 +77,7 @@ pub trait Qux {
7777
const QUX_DEFAULT2: u32 = 3;
7878
}
7979

80-
// @has assoc_consts/struct.Bar.html '//code' 'impl Qux for Bar'
80+
// @has assoc_consts/struct.Bar.html '//h3' 'impl Qux for Bar'
8181
impl Qux for Bar {
8282
// @has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8'
8383
// @has - '//*[@class="docblock"]' "Docs for QUX0 in trait."

src/test/rustdoc/assoc-types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
// @has assoc_types/trait.Index.html
44
pub trait Index<I: ?Sized> {
5-
// @has - '//*[@id="associatedtype.Output"]//code' 'type Output: ?Sized'
5+
// @has - '//*[@id="associatedtype.Output"]//h4' 'type Output: ?Sized'
66
type Output: ?Sized;
7-
// @has - '//*[@id="tymethod.index"]//code' \
7+
// @has - '//*[@id="tymethod.index"]//h4' \
88
// "fn index<'a>(&'a self, index: I) -> &'a Self::Output"
9-
// @has - '//*[@id="tymethod.index"]//code//a[@href="trait.Index.html#associatedtype.Output"]' \
9+
// @has - '//*[@id="tymethod.index"]//h4//a[@href="trait.Index.html#associatedtype.Output"]' \
1010
// "Output"
1111
fn index<'a>(&'a self, index: I) -> &'a Self::Output;
1212
}

src/test/rustdoc/async-fn.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ pub async fn quux() -> impl Bar {
3535
}
3636

3737
// @has async_fn/struct.Foo.html
38-
// @matches - '//code' 'pub async fn f\(\)$'
39-
// @matches - '//code' 'pub async unsafe fn g\(\)$'
40-
// @matches - '//code' 'pub async fn mut_self\(self, first: usize\)$'
38+
// @matches - '//h4' 'pub async fn f\(\)$'
39+
// @matches - '//h4' 'pub async unsafe fn g\(\)$'
40+
// @matches - '//h4' 'pub async fn mut_self\(self, first: usize\)$'
4141
pub struct Foo;
4242

4343
impl Foo {

src/test/rustdoc/blanket-reexport-item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![crate_name = "foo"]
22

3-
// @has foo/struct.S.html '//div[@id="impl-Into%3CU%3E"]//code' 'impl<T, U> Into<U> for T'
3+
// @has foo/struct.S.html '//div[@id="impl-Into%3CU%3E"]//h3' 'impl<T, U> Into<U> for T'
44
pub struct S2 {}
55
mod m {
66
pub struct S {}

src/test/rustdoc/const-display.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ pub const unsafe fn bar_not_gated() -> u32 { 42 }
4949
pub struct Foo;
5050

5151
impl Foo {
52-
// @has 'foo/struct.Foo.html' '//div[@id="method.gated"]/code' 'pub fn gated() -> u32'
52+
// @has 'foo/struct.Foo.html' '//div[@id="method.gated"]/h4' 'pub fn gated() -> u32'
5353
// @has - '//span[@class="since"]' '1.0.0 (const: unstable)'
5454
#[stable(feature = "rust1", since = "1.0.0")]
5555
#[rustc_const_unstable(feature="foo", issue = "none")]
5656
pub const fn gated() -> u32 { 42 }
5757

58-
// @has 'foo/struct.Foo.html' '//div[@id="method.gated_unsafe"]/code' 'pub unsafe fn gated_unsafe() -> u32'
58+
// @has 'foo/struct.Foo.html' '//div[@id="method.gated_unsafe"]/h4' 'pub unsafe fn gated_unsafe() -> u32'
5959
// @has - '//span[@class="since"]' '1.0.0 (const: unstable)'
6060
#[stable(feature = "rust1", since = "1.0.0")]
6161
#[rustc_const_unstable(feature="foo", issue = "none")]
6262
pub const unsafe fn gated_unsafe() -> u32 { 42 }
6363

64-
// @has 'foo/struct.Foo.html' '//div[@id="method.stable_impl"]/code' 'pub const fn stable_impl() -> u32'
64+
// @has 'foo/struct.Foo.html' '//div[@id="method.stable_impl"]/h4' 'pub const fn stable_impl() -> u32'
6565
// @has - '//span[@class="since"]' '1.0.0 (const: 1.2.0)'
6666
#[stable(feature = "rust1", since = "1.0.0")]
6767
#[rustc_const_stable(feature = "rust1", since = "1.2.0")]

src/test/rustdoc/const-generics/add-impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub struct Simd<T, const WIDTH: usize> {
88
inner: T,
99
}
1010

11-
// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//div/code' 'impl Add<Simd<u8, 16_usize>> for Simd<u8, 16>'
11+
// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//div/h3' 'impl Add<Simd<u8, 16_usize>> for Simd<u8, 16>'
1212
impl Add for Simd<u8, 16> {
1313
type Output = Self;
1414

src/test/rustdoc/const-generics/const-generics-docs.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ pub use extern_crate::WTrait;
1919

2020
// @has foo/trait.Trait.html '//pre[@class="rust trait"]' \
2121
// 'pub trait Trait<const N: usize>'
22-
// @has - '//*[@id="impl-Trait%3C1_usize%3E-for-u8"]//code' 'impl Trait<1_usize> for u8'
23-
// @has - '//*[@id="impl-Trait%3C2_usize%3E-for-u8"]//code' 'impl Trait<2_usize> for u8'
24-
// @has - '//*[@id="impl-Trait%3C{1%20+%202}%3E-for-u8"]//code' 'impl Trait<{1 + 2}> for u8'
25-
// @has - '//*[@id="impl-Trait%3CN%3E-for-%5Bu8%3B%20N%5D"]//code' \
22+
// @has - '//*[@id="impl-Trait%3C1_usize%3E-for-u8"]//h3' 'impl Trait<1_usize> for u8'
23+
// @has - '//*[@id="impl-Trait%3C2_usize%3E-for-u8"]//h3' 'impl Trait<2_usize> for u8'
24+
// @has - '//*[@id="impl-Trait%3C{1%20+%202}%3E-for-u8"]//h3' 'impl Trait<{1 + 2}> for u8'
25+
// @has - '//*[@id="impl-Trait%3CN%3E-for-%5Bu8%3B%20N%5D"]//h3' \
2626
// 'impl<const N: usize> Trait<N> for [u8; N]'
2727
pub trait Trait<const N: usize> {}
2828
impl Trait<1> for u8 {}
@@ -36,7 +36,7 @@ pub struct Foo<const N: usize> where u8: Trait<N>;
3636
// @has foo/struct.Bar.html '//pre[@class="rust struct"]' 'pub struct Bar<T, const N: usize>(_)'
3737
pub struct Bar<T, const N: usize>([T; N]);
3838

39-
// @has foo/struct.Foo.html '//div[@id="impl"]/code' 'impl<const M: usize> Foo<M> where u8: Trait<M>'
39+
// @has foo/struct.Foo.html '//div[@id="impl"]/h3' 'impl<const M: usize> Foo<M> where u8: Trait<M>'
4040
impl<const M: usize> Foo<M> where u8: Trait<M> {
4141
// @has - '//*[@id="associatedconstant.FOO_ASSOC"]' 'pub const FOO_ASSOC: usize'
4242
pub const FOO_ASSOC: usize = M + 13;
@@ -47,7 +47,7 @@ impl<const M: usize> Foo<M> where u8: Trait<M> {
4747
}
4848
}
4949

50-
// @has foo/struct.Bar.html '//div[@id="impl"]/code' 'impl<const M: usize> Bar<u8, M>'
50+
// @has foo/struct.Bar.html '//div[@id="impl"]/h3' 'impl<const M: usize> Bar<u8, M>'
5151
impl<const M: usize> Bar<u8, M> {
5252
// @has - '//*[@id="method.hey"]' \
5353
// 'pub fn hey<const N: usize>(&self) -> Foo<N> where u8: Trait<N>'

src/test/rustdoc/const-generics/const-impl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ pub enum Order {
99
}
1010

1111
// @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>'
12-
// @has foo/struct.VSet.html '//div[@id="impl-Send"]/code' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>'
13-
// @has foo/struct.VSet.html '//div[@id="impl-Sync"]/code' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>'
12+
// @has foo/struct.VSet.html '//div[@id="impl-Send"]/h3' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>'
13+
// @has foo/struct.VSet.html '//div[@id="impl-Sync"]/h3' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>'
1414
pub struct VSet<T, const ORDER: Order> {
1515
inner: Vec<T>,
1616
}
1717

18-
// @has foo/struct.VSet.html '//div[@id="impl"]/code' 'impl<T> VSet<T, {Order::Sorted}>'
18+
// @has foo/struct.VSet.html '//div[@id="impl"]/h3' 'impl<T> VSet<T, {Order::Sorted}>'
1919
impl <T> VSet<T, {Order::Sorted}> {
2020
pub fn new() -> Self {
2121
Self { inner: Vec::new() }
2222
}
2323
}
2424

25-
// @has foo/struct.VSet.html '//div[@id="impl-1"]/code' 'impl<T> VSet<T, {Order::Unsorted}>'
25+
// @has foo/struct.VSet.html '//div[@id="impl-1"]/h3' 'impl<T> VSet<T, {Order::Unsorted}>'
2626
impl <T> VSet<T, {Order::Unsorted}> {
2727
pub fn new() -> Self {
2828
Self { inner: Vec::new() }
@@ -31,7 +31,7 @@ impl <T> VSet<T, {Order::Unsorted}> {
3131

3232
pub struct Escape<const S: &'static str>;
3333

34-
// @has foo/struct.Escape.html '//div[@id="impl"]/code' 'impl Escape<{ r#"<script>alert("Escape");</script>"# }>'
34+
// @has foo/struct.Escape.html '//div[@id="impl"]/h3' 'impl Escape<{ r#"<script>alert("Escape");</script>"# }>'
3535
impl Escape<{ r#"<script>alert("Escape");</script>"# }> {
3636
pub fn f() {}
3737
}

0 commit comments

Comments
 (0)