Skip to content

Commit 05cd787

Browse files
Update rustdoc tests
1 parent eb3c3e3 commit 05cd787

16 files changed

+42
-56
lines changed

tests/rustdoc-gui/huge-collection-of-constants.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
go-to: "file://" + |DOC_PATH| + "/test_docs/huge_amount_of_consts/index.html"
44

55
compare-elements-position-near-false: (
6-
"//ul[@class='item-table']/li[last()-1]",
7-
"//ul[@class='item-table']/li[last()-3]",
6+
"//dl[@class='item-table']/dt[last()-1]",
7+
"//dl[@class='item-table']/dt[last()-3]",
88
{"y": 12},
99
)

tests/rustdoc-gui/item-name-wrap.goml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/short_docs/index.html"
33
set-window-size: (1000, 600)
44

55
// First we ensure that there is only one `item-table`...
6-
assert-count: ("ul.item-table", 1)
6+
assert-count: ("dl.item-table", 1)
77
// And only two items in it.
8-
assert-count: ("ul.item-table li", 2)
8+
assert-count: ("dl.item-table dt", 2)
99

1010
// If they don't have the same height, then it means one of the two is on two lines whereas it
1111
// shouldn't!
@@ -18,6 +18,6 @@ compare-elements-size: (
1818
// We also check that the `item-table` is taking the full width.
1919
compare-elements-size: (
2020
"#functions",
21-
"ul.item-table",
21+
"dl.item-table",
2222
["width"],
2323
)

tests/rustdoc/anonymous-reexport-108931.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mod bar {
1616
//@ count - '//*[@id="main-content"]/h2' 2
1717
//@ has - '//*[@id="main-content"]/h2' 'Re-exports'
1818
//@ has - '//*[@id="main-content"]/h2' 'Modules'
19-
//@ has - '//*[@id="main-content"]//*[@class="item-table"]//li//code' 'pub use foo::Foo as _;'
20-
//@ has - '//*[@id="main-content"]//*[@class="item-table"]//li//code' 'pub use bar::Bar as _;'
19+
//@ has - '//*[@id="main-content"]//*[@class="item-table reexports"]/dt//code' 'pub use foo::Foo as _;'
20+
//@ has - '//*[@id="main-content"]//*[@class="item-table reexports"]/dt//code' 'pub use bar::Bar as _;'
2121
pub use foo::Foo as _;
2222
pub use bar::Bar as _;

tests/rustdoc/anonymous-reexport.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//@ has - '//*[@id="main-content"]/h2' 'Structs'
1010
//@ has - '//*[@id="main-content"]/h2' 'Re-exports'
1111
// The 3 re-exports.
12-
//@ count - '//*[@id="main-content"]//*[@class="item-table"]//li//code' 3
12+
//@ count - '//*[@id="main-content"]//*[@class="item-table"]/dt//code' 3
1313
// The public struct.
1414
//@ count - '//*[@id="main-content"]//a[@class="struct"]' 1
1515

tests/rustdoc/glob-reexport-attribute-merge-120487.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
//@ has 'foo/index.html'
99
// There are two items.
10-
//@ count - '//*[@class="item-table"]//div[@class="item-name"]' 2
10+
//@ count - '//*[@class="item-table"]/dt[@class="item-name"]' 2
1111
// Only one of them should have an attribute.
12-
//@ count - '//*[@class="item-table"]//div[@class="item-name"]/*[@class="stab portability"]' 1
12+
//@ count - '//*[@class="item-table"]/dt[@class="item-name"]/*[@class="stab portability"]' 1
1313

1414
mod a {
1515
#[doc(cfg(not(feature = "a")))]

tests/rustdoc/glob-reexport-attribute-merge-doc-auto-cfg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
//@ has 'foo/index.html'
88
// There are two items.
9-
//@ count - '//*[@class="item-table"]//div[@class="item-name"]' 2
9+
//@ count - '//*[@class="item-table"]/dt[@class="item-name"]' 2
1010
// Only one of them should have an attribute.
11-
//@ count - '//*[@class="item-table"]//div[@class="item-name"]/*[@class="stab portability"]' 1
11+
//@ count - '//*[@class="item-table"]/dt[@class="item-name"]/*[@class="stab portability"]' 1
1212

1313
mod a {
1414
#[cfg(not(feature = "a"))]

tests/rustdoc/glob-shadowing-const.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ mod sub4 {
1515
pub use sub4::inner::*;
1616

1717
//@ has 'foo/index.html'
18-
//@ has - '//div[@class="desc docblock-short"]' '1'
19-
//@ !has - '//div[@class="desc docblock-short"]' '0'
18+
//@ has - '//dd[@class="desc docblock-short"]' '1'
19+
//@ !has - '//dd[@class="desc docblock-short"]' '0'
2020
fn main() { assert_eq!(X, 1); }

tests/rustdoc/glob-shadowing.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
//@ has 'glob_shadowing/index.html'
2-
//@ count - '//div[@class="item-name"]' 6
3-
//@ !has - '//div[@class="desc docblock-short"]' 'sub1::describe'
4-
//@ has - '//div[@class="desc docblock-short"]' 'sub2::describe'
2+
//@ count - '//dt[@class="item-name"]' 6
3+
//@ !has - '//dd[@class="desc docblock-short"]' 'sub1::describe'
4+
//@ has - '//dd[@class="desc docblock-short"]' 'sub2::describe'
55

6-
//@ !has - '//div[@class="desc docblock-short"]' 'sub1::describe2'
6+
//@ !has - '//dd[@class="desc docblock-short"]' 'sub1::describe2'
77

8-
//@ !has - '//div[@class="desc docblock-short"]' 'sub1::prelude'
9-
//@ has - '//div[@class="desc docblock-short"]' 'mod::prelude'
8+
//@ !has - '//dd[@class="desc docblock-short"]' 'sub1::prelude'
9+
//@ has - '//dd[@class="desc docblock-short"]' 'mod::prelude'
1010

11-
//@ has - '//div[@class="desc docblock-short"]' 'sub1::Foo (struct)'
12-
//@ has - '//div[@class="desc docblock-short"]' 'mod::Foo (function)'
11+
//@ has - '//dd[@class="desc docblock-short"]' 'sub1::Foo (struct)'
12+
//@ has - '//dd[@class="desc docblock-short"]' 'mod::Foo (function)'
1313

14-
//@ has - '//div[@class="desc docblock-short"]' 'sub4::inner::X'
14+
//@ has - '//dd[@class="desc docblock-short"]' 'sub4::inner::X'
1515

1616
//@ has 'glob_shadowing/fn.describe.html'
1717
//@ has - '//div[@class="docblock"]' 'sub2::describe'

tests/rustdoc/intra-doc/module-scope-name-resolution-55364.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ pub mod subone {
3232
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo'
3333
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar'
3434
// Though there should be such links later
35-
//@ has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="item-name"]/a[@class="fn"][@href="fn.foo.html"]' 'foo'
36-
//@ has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="item-name"]/a[@class="fn"][@href="fn.bar.html"]' 'bar'
35+
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dt[@class="item-name"]/a[@class="fn"][@href="fn.foo.html"]' 'foo'
36+
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dt[@class="item-name"]/a[@class="fn"][@href="fn.bar.html"]' 'bar'
3737
/// See either [foo] or [bar].
3838
pub mod subtwo {
3939

@@ -71,8 +71,8 @@ pub mod subthree {
7171
// Next we go *deeper* - In order to ensure it's not just "this or parent"
7272
// we test `crate::` and a `super::super::...` chain
7373
//@ has foo/subfour/subfive/subsix/subseven/subeight/index.html
74-
//@ has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo'
75-
//@ has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar'
74+
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dd[@class="desc docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo'
75+
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dd[@class="desc docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar'
7676
pub mod subfour {
7777
pub mod subfive {
7878
pub mod subsix {
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.MY_CONSTANT.html" title="constant item_desc_list_at_start::MY_CONSTANT">MY_<wbr />CONSTANT</a></div><div class="desc docblock-short">Groups: <code>SamplePatternSGIS</code>, <code>SamplePatternEXT</code></div></li></ul>
1+
<dl class="item-table"><dt class="item-name"><a class="constant" href="constant.MY_CONSTANT.html" title="constant item_desc_list_at_start::MY_CONSTANT">MY_<wbr />CONSTANT</a></dt><dd class="desc docblock-short">Groups: <code>SamplePatternSGIS</code>, <code>SamplePatternEXT</code></dd></dl>

tests/rustdoc/item-desc-list-at-start.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//@ has item_desc_list_at_start/index.html
2-
//@ count - '//ul[@class="item-table"]/li/div/li' 0
3-
//@ count - '//ul[@class="item-table"]/li' 1
4-
//@ snapshot item-table - '//ul[@class="item-table"]'
2+
//@ count - '//dl[@class="item-table"]/dd//ul' 0
3+
//@ count - '//dl[@class="item-table"]/dd//li' 0
4+
//@ count - '//dl[@class="item-table"]/dd' 1
5+
//@ snapshot item-table - '//dl[@class="item-table"]'
56

67
// based on https://docs.rs/gl_constants/0.1.1/src/gl_constants/lib.rs.html#16
78

tests/rustdoc/macro-rules-broken-intra-doc-106142.rs

-17
This file was deleted.

tests/rustdoc/reexport-cfg.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ pub use crate::foo::Bar as Babar;
2121
#[doc(cfg(not(feature = "cake")))]
2222
pub use crate::foo::Bar2 as Babar2;
2323

24-
//@ has - '//*[@class="item-table"]/li' 'pub use crate::Babar as Elephant;Non-robot'
24+
//@ has - '//*[@class="item-table"]/dt' 'pub use crate::Babar as Elephant;'
25+
//@ has - '//*[@class="item-table"]/dd' 'Non-robot'
2526
#[cfg(not(feature = "robot"))]
2627
pub use crate::Babar as Elephant;
2728

28-
//@ has - '//*[@class="item-table"]/li' 'pub use crate::Babar2 as Elephant2;Non-cat'
29+
//@ has - '//*[@class="item-table"]/dt' 'pub use crate::Babar2 as Elephant2;'
30+
//@ has - '//*[@class="item-table"]/dd' 'Non-cat'
2931
#[doc(cfg(not(feature = "cat")))]
3032
pub use crate::Babar2 as Elephant2;

tests/rustdoc/reexport-check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ extern crate reexport_check;
88
#[allow(deprecated, deprecated_in_future)]
99
pub use std::i32;
1010
//@ !has 'foo/index.html' '//code' 'pub use self::string::String;'
11-
//@ has 'foo/index.html' '//div[@class="item-name"]' 'String'
11+
//@ has 'foo/index.html' '//dt[@class="item-name"]' 'String'
1212
pub use std::string::String;
1313

1414
// i32 is deprecated, String is not
1515
//@ count 'foo/index.html' '//span[@class="stab deprecated"]' 1
1616

17-
//@ has 'foo/index.html' '//div[@class="desc docblock-short"]' 'Docs in original'
17+
//@ has 'foo/index.html' '//dd[@class="desc docblock-short"]' 'Docs in original'
1818
// this is a no-op, but shows what happens if there's an attribute that isn't a doc-comment
1919
#[doc(inline)]
2020
pub use reexport_check::S;

tests/rustdoc/reexport-doc-hidden-inside-private.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ mod private_module {
1212
//@ has - '//*[@id="reexport.Foo"]/code' 'pub use crate::private_module::Public as Foo;'
1313
pub use crate::private_module::Public as Foo;
1414
// Glob re-exports with no visible items should not be displayed.
15-
//@ count - '//*[@class="item-table"]/li' 1
15+
//@ count - '//*[@class="item-table"]/dt' 1
1616
pub use crate::private_module::*;

tests/rustdoc/stability.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
#![stable(feature = "core", since = "1.6.0")]
66

77
//@ has stability/index.html
8-
//@ has - '//ul[@class="item-table"]/li[1]//a' AaStable
9-
//@ has - '//ul[@class="item-table"]/li[2]//a' ZzStable
10-
//@ has - '//ul[@class="item-table"]/li[3]//a' Unstable
8+
//@ has - '//dl[@class="item-table"]/dt[1]//a' AaStable
9+
//@ has - '//dl[@class="item-table"]/dt[2]//a' ZzStable
10+
//@ has - '//dl[@class="item-table"]/dt[3]//a' Unstable
1111

1212
#[stable(feature = "rust2", since = "2.2.2")]
1313
pub struct AaStable;

0 commit comments

Comments
 (0)