Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: rename issue-\d+.rs tests to have meaningful names (part 5) #119561

Merged
merged 3 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// check-pass
// https://github.com/rust-lang/rust/issues/52873
#![crate_name="foo"]

// Regression test for #52873. We used to ICE due to unexpected
// overflows when checking for "blanket impl inclusion".

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// check-pass
// https://github.com/rust-lang/rust/issues/55001
#![crate_name="foo"]

// Regression test for issue #55001. Previously, we would incorrectly
// cache certain trait selection results when checking for blanket impls,
// resulting in an ICE when we tried to confirm the cached ParamCandidate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// https://github.com/rust-lang/rust/issues/50159
#![crate_name="foo"]

pub trait Signal {
type Item;
}
Expand All @@ -10,7 +13,7 @@ impl<B, C> Signal2 for B where B: Signal<Item = C> {
type Item2 = C;
}

// @has issue_50159/struct.Switch.html
// @has foo/struct.Switch.html
// @has - '//h3[@class="code-header"]' 'impl<B> Send for Switch<B>where <B as Signal>::Item: Send'
// @has - '//h3[@class="code-header"]' 'impl<B> Sync for Switch<B>where <B as Signal>::Item: Sync'
// @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// https://github.com/rust-lang/rust/issues/54705
#![crate_name="foo"]

pub trait ScopeHandle<'scope> {}

// @has issue_54705/struct.ScopeFutureContents.html
// @has foo/struct.ScopeFutureContents.html
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
// "impl<'scope, S> Send for ScopeFutureContents<'scope, S>where S: Sync"
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// https://github.com/rust-lang/rust/issues/51236
#![crate_name="foo"]

use std::marker::PhantomData;

pub mod traits {
Expand All @@ -6,7 +9,7 @@ pub mod traits {
}
}

// @has issue_51236/struct.Owned.html
// @has foo/struct.Owned.html
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
// "impl<T> Send for Owned<T>where <T as Owned<'static>>::Reader: Send"
pub struct Owned<T> where T: for<'a> ::traits::Owned<'a> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// https://github.com/rust-lang/rust/issues/55321
#![crate_name="foo"]

#![feature(negative_impls)]

// @has issue_55321/struct.A.html
// @has foo/struct.A.html
// @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
// "impl !Send for A"
// @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
Expand All @@ -10,7 +13,7 @@ pub struct A();
impl !Send for A {}
impl !Sync for A {}

// @has issue_55321/struct.B.html
// @has foo/struct.B.html
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
// "impl<T> !Send for B<T>"
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
Expand Down
11 changes: 11 additions & 0 deletions tests/rustdoc/blank-line-in-doc-block-47197.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// https://github.com/rust-lang/rust/issues/47197
#![crate_name="foo"]

// @has foo/fn.whose_woods_these_are_i_think_i_know.html

/**
* snow

* ice
*/
pub fn whose_woods_these_are_i_think_i_know() {}
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// https://github.com/rust-lang/rust/issues/54478
#![crate_name="foo"]

// Issue #54478: regression test showing that we can demonstrate
// `#[global_allocator]` in code blocks built by `rustdoc`.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// https://github.com/rust-lang/rust/issues/35169
#![crate_name="foo"]

use std::ops::Deref;
use std::ops::DerefMut;

Expand All @@ -23,7 +26,7 @@ impl DerefMut for Bar {
fn deref_mut(&mut self) -> &mut Foo { loop {} }
}

// @has issue_35169_2/struct.Bar.html
// @has foo/struct.Bar.html
// @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)'
// @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
// @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// https://github.com/rust-lang/rust/issues/35169
#![crate_name="foo"]

use std::ops::Deref;

pub struct Foo;
Expand All @@ -18,7 +21,7 @@ impl Deref for Bar {
fn deref(&self) -> &Foo { loop {} }
}

// @has issue_35169/struct.Bar.html
// @has foo/struct.Bar.html
// @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)'
// @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
// @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// https://github.com/rust-lang/rust/issues/42760
#![crate_name="foo"]

#![allow(rustdoc::invalid_rust_codeblocks)]

// @has issue_42760/struct.NonGen.html
// @has foo/struct.NonGen.html
// @has - '//h2' 'Example'

/// Item docs.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// @has issue_41783/struct.Foo.html
// https://github.com/rust-lang/rust/issues/41783
#![crate_name="foo"]

// @has foo/struct.Foo.html
// @!hasraw - 'space'
// @!hasraw - 'comment'
// @hasraw - '<span class="attr">#[outer]'
Expand Down
16 changes: 16 additions & 0 deletions tests/rustdoc/enum-variant-reexport-35488.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// https://github.com/rust-lang/rust/issues/35488
#![crate_name="foo"]

mod foo {
pub enum Foo {
Bar,
}
pub use self::Foo::*;
}

// @has 'foo/index.html' '//code' 'pub use self::Foo::*;'
// @has 'foo/enum.Foo.html'
pub use self::foo::*;

// @has 'foo/index.html' '//code' 'pub use std::option::Option::None;'
pub use std::option::Option::None;
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/53689
// aux-build:issue-53689.rs

#![crate_name = "foo"]
Expand Down
27 changes: 15 additions & 12 deletions tests/rustdoc/issue-43869.rs → tests/rustdoc/impl-trait-43869.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// https://github.com/rust-lang/rust/issues/43869
#![crate_name="foo"]

pub fn g() -> impl Iterator<Item=u8> {
Some(1u8).into_iter()
}
Expand Down Expand Up @@ -58,15 +61,15 @@ pub fn test_44731_4() -> Box<Iterator<Item=impl Clone>> {
Box::new(g())
}

// @has issue_43869/fn.g.html
// @has issue_43869/fn.h.html
// @has issue_43869/fn.i.html
// @has issue_43869/fn.j.html
// @has issue_43869/fn.k.html
// @has issue_43869/fn.l.html
// @has issue_43869/fn.m.html
// @has issue_43869/fn.n.html
// @has issue_43869/fn.o.html
// @has issue_43869/fn.test_44731_0.html
// @has issue_43869/fn.test_44731_1.html
// @has issue_43869/fn.test_44731_4.html
// @has foo/fn.g.html
// @has foo/fn.h.html
// @has foo/fn.i.html
// @has foo/fn.j.html
// @has foo/fn.k.html
// @has foo/fn.l.html
// @has foo/fn.m.html
// @has foo/fn.n.html
// @has foo/fn.o.html
// @has foo/fn.test_44731_0.html
// @has foo/fn.test_44731_1.html
// @has foo/fn.test_44731_4.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// https://github.com/rust-lang/rust/issues/46727
#![crate_name="foo"]

// aux-build:issue-46727.rs

extern crate issue_46727;

// @has issue_46727/trait.Foo.html
// @has foo/trait.Foo.html
// @has - '//h3[@class="code-header"]' 'impl<T> Foo for Bar<[T; 3]>'
pub use issue_46727::{Foo, Bar};
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
// https://github.com/rust-lang/rust/issues/55364
#![crate_name="foo"]

// First a module with inner documentation

// @has issue_55364/subone/index.html
// @has foo/subone/index.html
// These foo/bar links in the module's documentation should refer inside `subone`
// @has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
// @has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
pub mod subone {
//! See either [foo] or [bar].

// This should refer to subone's `bar`
// @has issue_55364/subone/fn.foo.html
// @has foo/subone/fn.foo.html
// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
/// See [bar]
pub fn foo() {}
// This should refer to subone's `foo`
// @has issue_55364/subone/fn.bar.html
// @has foo/subone/fn.bar.html
// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
/// See [foo]
pub fn bar() {}
}

// A module with outer documentation

// @has issue_55364/subtwo/index.html
// @has foo/subtwo/index.html
// These foo/bar links in the module's documentation should not reference inside `subtwo`
// @!has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
// @!has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
Expand All @@ -36,13 +39,13 @@ pub mod subtwo {

// Despite the module's docs referring to the top level foo/bar,
// this should refer to subtwo's `bar`
// @has issue_55364/subtwo/fn.foo.html
// @has foo/subtwo/fn.foo.html
// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
/// See [bar]
pub fn foo() {}
// Despite the module's docs referring to the top level foo/bar,
// this should refer to subtwo's `foo`
// @has issue_55364/subtwo/fn.bar.html
// @has foo/subtwo/fn.bar.html
// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
/// See [foo]
pub fn bar() {}
Expand All @@ -57,7 +60,7 @@ pub fn bar() {}

// This module refers to the outer foo/bar by means of `super::`

// @has issue_55364/subthree/index.html
// @has foo/subthree/index.html
// This module should also refer to the top level foo/bar
// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo'
// @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar'
Expand All @@ -67,7 +70,7 @@ pub mod subthree {

// Next we go *deeper* - In order to ensure it's not just "this or parent"
// we test `crate::` and a `super::super::...` chain
// @has issue_55364/subfour/subfive/subsix/subseven/subeight/index.html
// @has foo/subfour/subfive/subsix/subseven/subeight/index.html
// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo'
// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar'
pub mod subfour {
Expand Down
13 changes: 0 additions & 13 deletions tests/rustdoc/issue-35488.rs

This file was deleted.

3 changes: 0 additions & 3 deletions tests/rustdoc/issue-46377.rs

This file was deleted.

8 changes: 0 additions & 8 deletions tests/rustdoc/issue-47197-blank-line-in-doc-block.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// https://github.com/rust-lang/rust/issues/46380
#![crate_name="foo"]

pub trait PublicTrait<T> {}

// @has issue_46380_2/struct.PublicStruct.html
// @has foo/struct.PublicStruct.html
pub struct PublicStruct;

// @!has - '//*[@class="impl"]' 'impl PublicTrait<PrivateStruct> for PublicStruct'
Expand Down
5 changes: 4 additions & 1 deletion tests/rustdoc/issue-53812.rs → tests/rustdoc/sort-53812.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// https://github.com/rust-lang/rust/issues/53812
#![crate_name="foo"]

pub trait MyIterator {}

pub struct MyStruct<T>(T);
Expand All @@ -11,7 +14,7 @@ macro_rules! array_impls {
}
}

// @has issue_53812/trait.MyIterator.html
// @has foo/trait.MyIterator.html
// @has - '//*[@id="implementors-list"]/*[@class="impl"][1]' 'MyStruct<[T; 0]>'
// @has - '//*[@id="implementors-list"]/*[@class="impl"][2]' 'MyStruct<[T; 1]>'
// @has - '//*[@id="implementors-list"]/*[@class="impl"][3]' 'MyStruct<[T; 2]>'
Expand Down
6 changes: 6 additions & 0 deletions tests/rustdoc/summary-header-46377.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// https://github.com/rust-lang/rust/issues/46377
#![crate_name="foo"]

// @has 'foo/index.html' '//*[@class="desc docblock-short"]' 'Check out this struct!'
/// # Check out this struct!
pub struct SomeStruct;
Loading