Skip to content

Commit

Permalink
Update rustdoc headings tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 25, 2022
1 parent 79da81e commit 038c3f8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
15 changes: 10 additions & 5 deletions src/test/rustdoc/issue-29449.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 2,23 @@
pub struct Foo;

impl Foo {
// @has - '//*[@id="examples"]//a' 'Examples'
// @has - '//*[@id="panics"]//a' 'Panics'
// @has - '//*[@id="examples"]' 'Examples'
// @has - '//*[@id="examples"]/a[@href="#examples"]' '§'
// @has - '//*[@id="panics"]' 'Panics'
// @has - '//*[@id="panics"]/a[@href="#panics"]' '§'
/// # Examples
/// # Panics
pub fn bar() {}

// @has - '//*[@id="examples-1"]//a' 'Examples'
// @has - '//*[@id="examples-1"]' 'Examples'
// @has - '//*[@id="examples-1"]/a[@href="#examples-1"]' '§'
/// # Examples
pub fn bar_1() {}

// @has - '//*[@id="examples-2"]//a' 'Examples'
// @has - '//*[@id="panics-1"]//a' 'Panics'
// @has - '//*[@id="examples-2"]' 'Examples'
// @has - '//*[@id="examples-2"]/a[@href="#examples-2"]' '§'
// @has - '//*[@id="panics-1"]' 'Panics'
// @has - '//*[@id="panics-1"]/a[@href="#panics-1"]' '§'
/// # Examples
/// # Panics
pub fn bar_2() {}
Expand Down
11 changes: 7 additions & 4 deletions src/test/rustdoc/remove-url-from-headings.rs
Original file line number Diff line number Diff line change
@@ -1,9 1,12 @@
// It actually checks that the link is kept in the headings as expected now.

#![crate_name = "foo"]

// @has foo/fn.foo.html
// @!has - '//a[@href="http://a.a"]'
// @has - '//a[@href="#implementing-stuff-somewhere"]' 'Implementing stuff somewhere'
// @has - '//a[@href="#another-one-urg"]' 'Another one urg'
// @has - '//a[@href="http://a.a"]' 'stuff'
// @has - '//*[@id="implementing-stuff-somewhere"]' 'Implementing stuff somewhere'
// @has - '//a[@href="http://b.b"]' 'one'
// @has - '//*[@id="another-one-urg"]' 'Another one urg'

/// fooo
///
Expand All @@ -13,5 16,5 @@
///
/// # Another [one][two] urg
///
/// [two]: http://a.a
/// [two]: http://b.b
pub fn foo() {}
6 changes: 4 additions & 2 deletions src/test/rustdoc/short-docblock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 2,19 @@

// @has foo/index.html '//*[@class="item-right docblock-short"]/p' 'fooo'
// @!has foo/index.html '//*[@class="item-right docblock-short"]/p/h1' 'fooo'
// @has foo/fn.foo.html '//h2[@id="fooo"]/a[@href="#fooo"]' 'fooo'

// @has foo/fn.foo.html '//h2[@id="fooo"]' 'fooo'
// @has foo/fn.foo.html '//h2[@id="fooo"]/a[@href="#fooo"]' '§'
/// # fooo
///
/// foo
pub fn foo() {}

// @has foo/index.html '//*[@class="item-right docblock-short"]/p' 'mooood'
// @!has foo/index.html '//*[@class="item-right docblock-short"]/p/h2' 'mooood'
// @has foo/foo/index.html '//h3[@id="mooood"]/a[@href="#mooood"]' 'mooood'

// @has foo/foo/index.html '//h3[@id="mooood"]' 'mooood'
// @has foo/foo/index.html '//h3[@id="mooood"]/a[@href="#mooood"]' '§'
/// ## mooood
///
/// foo mod
Expand Down

0 comments on commit 038c3f8

Please sign in to comment.