From 69dc19043bee2ce720f83bf1d6582240547c842e Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 16 Oct 2023 16:06:58 -0700 Subject: Rename `issue-\d+.rs` tests to have meaningful names --- tests/rustdoc/auxiliary/issue-29584.rs | 10 ---- tests/rustdoc/blanket-impl-29503.rs | 20 +++++++ tests/rustdoc/const-rendering-macros-33302.rs | 53 +++++++++++++++++ tests/rustdoc/disambiguate-anchors-32890.rs | 19 +++++++ tests/rustdoc/disambiguate-anchors-header-29449.rs | 22 ++++++++ .../rustdoc/doc-hidden-trait-implementors-33069.rs | 12 ++++ tests/rustdoc/doctest-cfg-feature-30252.rs | 8 +++ tests/rustdoc/doctest-ignore-32556.rs | 7 +++ tests/rustdoc/hidden-extern-34025.rs | 12 ++++ .../rustdoc/ice-assoc-const-for-primitive-31808.rs | 13 +++++ tests/rustdoc/impl-type-parameter-33592.rs | 13 +++++ .../rustdoc/inline_cross/auxiliary/issue-29584.rs | 10 ++++ .../doc-hidden-extern-trait-impl-29584.rs | 10 ++++ tests/rustdoc/issue-29449.rs | 22 -------- tests/rustdoc/issue-29503.rs | 20 ------- tests/rustdoc/issue-29584.rs | 10 ---- tests/rustdoc/issue-30109.rs | 16 ------ tests/rustdoc/issue-30252.rs | 8 --- tests/rustdoc/issue-30366.rs | 8 --- tests/rustdoc/issue-31808.rs | 13 ----- tests/rustdoc/issue-31899.rs | 61 -------------------- tests/rustdoc/issue-32077-type-alias-impls.rs | 66 ---------------------- tests/rustdoc/issue-32374.rs | 32 ----------- tests/rustdoc/issue-32395.rs | 17 ------ tests/rustdoc/issue-32556.rs | 7 --- tests/rustdoc/issue-32890.rs | 19 ------- tests/rustdoc/issue-33069.rs | 12 ---- tests/rustdoc/issue-33178-1.rs | 12 ---- tests/rustdoc/issue-33178.rs | 16 ------ tests/rustdoc/issue-33302.rs | 53 ----------------- tests/rustdoc/issue-33592.rs | 13 ----- tests/rustdoc/issue-34025.rs | 12 ---- tests/rustdoc/issue-34274.rs | 10 ---- tests/rustdoc/link-extern-crate-33178.rs | 16 ++++++ tests/rustdoc/link-extern-crate-item-30109.rs | 16 ++++++ tests/rustdoc/link-extern-crate-title-33178.rs | 12 ++++ .../render-enum-variant-structlike-32395.rs | 17 ++++++ tests/rustdoc/src-links-inlined-34274.rs | 10 ++++ .../staged-api-deprecated-unstable-32374.rs | 32 +++++++++++ tests/rustdoc/summary-codeblock-31899.rs | 61 ++++++++++++++++++++ tests/rustdoc/summary-reference-link-30366.rs | 8 +++ tests/rustdoc/type-alias-impls-32077.rs | 66 ++++++++++++++++++++++ 42 files changed, 437 insertions(+), 437 deletions(-) delete mode 100644 tests/rustdoc/auxiliary/issue-29584.rs create mode 100644 tests/rustdoc/blanket-impl-29503.rs create mode 100644 tests/rustdoc/const-rendering-macros-33302.rs create mode 100644 tests/rustdoc/disambiguate-anchors-32890.rs create mode 100644 tests/rustdoc/disambiguate-anchors-header-29449.rs create mode 100644 tests/rustdoc/doc-hidden-trait-implementors-33069.rs create mode 100644 tests/rustdoc/doctest-cfg-feature-30252.rs create mode 100644 tests/rustdoc/doctest-ignore-32556.rs create mode 100644 tests/rustdoc/hidden-extern-34025.rs create mode 100644 tests/rustdoc/ice-assoc-const-for-primitive-31808.rs create mode 100644 tests/rustdoc/impl-type-parameter-33592.rs create mode 100644 tests/rustdoc/inline_cross/auxiliary/issue-29584.rs create mode 100644 tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs delete mode 100644 tests/rustdoc/issue-29449.rs delete mode 100644 tests/rustdoc/issue-29503.rs delete mode 100644 tests/rustdoc/issue-29584.rs delete mode 100644 tests/rustdoc/issue-30109.rs delete mode 100644 tests/rustdoc/issue-30252.rs delete mode 100644 tests/rustdoc/issue-30366.rs delete mode 100644 tests/rustdoc/issue-31808.rs delete mode 100644 tests/rustdoc/issue-31899.rs delete mode 100644 tests/rustdoc/issue-32077-type-alias-impls.rs delete mode 100644 tests/rustdoc/issue-32374.rs delete mode 100644 tests/rustdoc/issue-32395.rs delete mode 100644 tests/rustdoc/issue-32556.rs delete mode 100644 tests/rustdoc/issue-32890.rs delete mode 100644 tests/rustdoc/issue-33069.rs delete mode 100644 tests/rustdoc/issue-33178-1.rs delete mode 100644 tests/rustdoc/issue-33178.rs delete mode 100644 tests/rustdoc/issue-33302.rs delete mode 100644 tests/rustdoc/issue-33592.rs delete mode 100644 tests/rustdoc/issue-34025.rs delete mode 100644 tests/rustdoc/issue-34274.rs create mode 100644 tests/rustdoc/link-extern-crate-33178.rs create mode 100644 tests/rustdoc/link-extern-crate-item-30109.rs create mode 100644 tests/rustdoc/link-extern-crate-title-33178.rs create mode 100644 tests/rustdoc/render-enum-variant-structlike-32395.rs create mode 100644 tests/rustdoc/src-links-inlined-34274.rs create mode 100644 tests/rustdoc/staged-api-deprecated-unstable-32374.rs create mode 100644 tests/rustdoc/summary-codeblock-31899.rs create mode 100644 tests/rustdoc/summary-reference-link-30366.rs create mode 100644 tests/rustdoc/type-alias-impls-32077.rs (limited to 'tests/rustdoc') diff --git a/tests/rustdoc/auxiliary/issue-29584.rs b/tests/rustdoc/auxiliary/issue-29584.rs deleted file mode 100644 index a9b8796c0fe..00000000000 --- a/tests/rustdoc/auxiliary/issue-29584.rs +++ /dev/null @@ -1,10 +0,0 @@ -// compile-flags: -Cmetadata=aux - -pub struct Foo; - -#[doc(hidden)] -mod bar { - trait Bar {} - - impl Bar for ::Foo {} -} diff --git a/tests/rustdoc/blanket-impl-29503.rs b/tests/rustdoc/blanket-impl-29503.rs new file mode 100644 index 00000000000..310acd09a82 --- /dev/null +++ b/tests/rustdoc/blanket-impl-29503.rs @@ -0,0 +1,20 @@ +#![crate_name="issue_29503"] + +use std::fmt; + +// @has issue_29503/trait.MyTrait.html +pub trait MyTrait { + fn my_string(&self) -> String; +} + +// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header']" "impl MyTrait for Twhere T: Debug" +impl MyTrait for T +where + T: fmt::Debug, +{ + fn my_string(&self) -> String { + format!("{:?}", self) + } +} + +pub fn main() {} diff --git a/tests/rustdoc/const-rendering-macros-33302.rs b/tests/rustdoc/const-rendering-macros-33302.rs new file mode 100644 index 00000000000..b4e6cc7aaac --- /dev/null +++ b/tests/rustdoc/const-rendering-macros-33302.rs @@ -0,0 +1,53 @@ +#![crate_name="issue_33302"] + +// Ensure constant and array length values are not taken from source +// code, which wreaks havoc with macros. + +macro_rules! make { + ($n:expr) => { + pub struct S; + + // @has issue_33302/constant.CST.html \ + // '//pre[@class="rust item-decl"]' 'pub const CST: i32' + pub const CST: i32 = ($n * $n); + // @has issue_33302/static.ST.html \ + // '//pre[@class="rust item-decl"]' 'pub static ST: i32' + pub static ST: i32 = ($n * $n); + + pub trait T { + fn ignore(_: &X) {} + const C: X; + // @has issue_33302/trait.T.html \ + // '//pre[@class="rust item-decl"]' 'const D: i32' + // @has - '//*[@id="associatedconstant.D"]' 'const D: i32' + const D: i32 = ($n * $n); + } + + // @has issue_33302/struct.S.html \ + // '//*[@class="impl"]' 'impl T<[i32; 16]> for S' + // @has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16]' + // @has - '//*[@id="associatedconstant.D"]' 'const D: i32' + impl T<[i32; ($n * $n)]> for S { + const C: [i32; ($n * $n)] = [0; ($n * $n)]; + } + + // @has issue_33302/struct.S.html \ + // '//*[@class="impl"]' 'impl T<[i32; 16]> for S' + // @has - '//*[@id="associatedconstant.C-1"]' 'const C: (i32,)' + // @has - '//*[@id="associatedconstant.D-1"]' 'const D: i32' + impl T<(i32,)> for S { + const C: (i32,) = ($n,); + } + + // @has issue_33302/struct.S.html \ + // '//*[@class="impl"]' 'impl T<(i32, i32)> for S' + // @has - '//*[@id="associatedconstant.C-2"]' 'const C: (i32, i32)' + // @has - '//*[@id="associatedconstant.D-2"]' 'const D: i32' + impl T<(i32, i32)> for S { + const C: (i32, i32) = ($n, $n); + const D: i32 = ($n / $n); + } + }; +} + +make!(4); diff --git a/tests/rustdoc/disambiguate-anchors-32890.rs b/tests/rustdoc/disambiguate-anchors-32890.rs new file mode 100644 index 00000000000..dfac0ef22b7 --- /dev/null +++ b/tests/rustdoc/disambiguate-anchors-32890.rs @@ -0,0 +1,19 @@ +#![crate_name="issue_32890"] + +// @has issue_32890/struct.Foo.html +pub struct Foo(T); + +impl Foo { + // @has - '//a[@href="#method.pass"]' 'pass' + pub fn pass() {} +} + +impl Foo { + // @has - '//a[@href="#method.pass-1"]' 'pass' + pub fn pass() {} +} + +impl Foo { + // @has - '//a[@href="#method.pass-2"]' 'pass' + pub fn pass() {} +} diff --git a/tests/rustdoc/disambiguate-anchors-header-29449.rs b/tests/rustdoc/disambiguate-anchors-header-29449.rs new file mode 100644 index 00000000000..0b9b29a69ee --- /dev/null +++ b/tests/rustdoc/disambiguate-anchors-header-29449.rs @@ -0,0 +1,22 @@ +#![crate_name="issue_29449"] + +// @has issue_29449/struct.Foo.html +pub struct Foo; + +impl Foo { + // @has - '//*[@id="examples"]//a' 'Examples' + // @has - '//*[@id="panics"]//a' 'Panics' + /// # Examples + /// # Panics + pub fn bar() {} + + // @has - '//*[@id="examples-1"]//a' 'Examples' + /// # Examples + pub fn bar_1() {} + + // @has - '//*[@id="examples-2"]//a' 'Examples' + // @has - '//*[@id="panics-1"]//a' 'Panics' + /// # Examples + /// # Panics + pub fn bar_2() {} +} diff --git a/tests/rustdoc/doc-hidden-trait-implementors-33069.rs b/tests/rustdoc/doc-hidden-trait-implementors-33069.rs new file mode 100644 index 00000000000..9c0e0014bd1 --- /dev/null +++ b/tests/rustdoc/doc-hidden-trait-implementors-33069.rs @@ -0,0 +1,12 @@ +#![crate_name="issue_33069"] + +pub trait Bar {} + +#[doc(hidden)] +pub mod hidden { + pub struct Foo; +} + +// @has issue_33069/trait.Bar.html +// @!has - '//code' 'impl Bar for Foo' +impl Bar for hidden::Foo {} diff --git a/tests/rustdoc/doctest-cfg-feature-30252.rs b/tests/rustdoc/doctest-cfg-feature-30252.rs new file mode 100644 index 00000000000..749c63d741c --- /dev/null +++ b/tests/rustdoc/doctest-cfg-feature-30252.rs @@ -0,0 +1,8 @@ +// compile-flags:--test --cfg feature="bar" + +#![crate_name="issue_30252"] + +/// ```rust +/// assert_eq!(cfg!(feature = "bar"), true); +/// ``` +pub fn foo() {} diff --git a/tests/rustdoc/doctest-ignore-32556.rs b/tests/rustdoc/doctest-ignore-32556.rs new file mode 100644 index 00000000000..369aef72e19 --- /dev/null +++ b/tests/rustdoc/doctest-ignore-32556.rs @@ -0,0 +1,7 @@ +#![crate_name="issue_32556"] + +/// Blah blah blah +/// ```ignore (testing rustdoc's handling of ignore) +/// bad_assert!(); +/// ``` +pub fn foo() {} diff --git a/tests/rustdoc/hidden-extern-34025.rs b/tests/rustdoc/hidden-extern-34025.rs new file mode 100644 index 00000000000..9b9f21cb316 --- /dev/null +++ b/tests/rustdoc/hidden-extern-34025.rs @@ -0,0 +1,12 @@ +#![crate_name = "foo"] + +// @!has 'foo/sys/index.html' +// @!has 'foo/sys/sidebar-items.js' +#[doc(hidden)] +pub mod sys { + extern "C" { + // @!has 'foo/sys/fn.foo.html' + #[doc(hidden)] + pub fn foo(); + } +} diff --git a/tests/rustdoc/ice-assoc-const-for-primitive-31808.rs b/tests/rustdoc/ice-assoc-const-for-primitive-31808.rs new file mode 100644 index 00000000000..58f9daaff59 --- /dev/null +++ b/tests/rustdoc/ice-assoc-const-for-primitive-31808.rs @@ -0,0 +1,13 @@ +// Test that associated item impls on primitive types don't crash rustdoc + +#![crate_name="issue_31808"] + +pub trait Foo { + const BAR: usize; + type BAZ; +} + +impl Foo for () { + const BAR: usize = 0; + type BAZ = usize; +} diff --git a/tests/rustdoc/impl-type-parameter-33592.rs b/tests/rustdoc/impl-type-parameter-33592.rs new file mode 100644 index 00000000000..7a128f0b897 --- /dev/null +++ b/tests/rustdoc/impl-type-parameter-33592.rs @@ -0,0 +1,13 @@ +#![crate_name = "foo"] + +pub trait Foo {} + +pub struct Bar; + +pub struct Baz; + +// @has foo/trait.Foo.html '//h3[@class="code-header"]' 'impl Foo for Bar' +impl Foo for Bar {} + +// @has foo/trait.Foo.html '//h3[@class="code-header"]' 'impl Foo for Baz' +impl Foo for Baz {} diff --git a/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs b/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs new file mode 100644 index 00000000000..a9b8796c0fe --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs @@ -0,0 +1,10 @@ +// compile-flags: -Cmetadata=aux + +pub struct Foo; + +#[doc(hidden)] +mod bar { + trait Bar {} + + impl Bar for ::Foo {} +} diff --git a/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs b/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs new file mode 100644 index 00000000000..6e3feafc7ad --- /dev/null +++ b/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs @@ -0,0 +1,10 @@ +// aux-build:issue-29584.rs +// ignore-cross-compile + +#![crate_name="issue_29584"] + +extern crate issue_29584; + +// @has issue_29584/struct.Foo.html +// @!hasraw - 'impl Bar for' +pub use issue_29584::Foo; diff --git a/tests/rustdoc/issue-29449.rs b/tests/rustdoc/issue-29449.rs deleted file mode 100644 index 0b9b29a69ee..00000000000 --- a/tests/rustdoc/issue-29449.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![crate_name="issue_29449"] - -// @has issue_29449/struct.Foo.html -pub struct Foo; - -impl Foo { - // @has - '//*[@id="examples"]//a' 'Examples' - // @has - '//*[@id="panics"]//a' 'Panics' - /// # Examples - /// # Panics - pub fn bar() {} - - // @has - '//*[@id="examples-1"]//a' 'Examples' - /// # Examples - pub fn bar_1() {} - - // @has - '//*[@id="examples-2"]//a' 'Examples' - // @has - '//*[@id="panics-1"]//a' 'Panics' - /// # Examples - /// # Panics - pub fn bar_2() {} -} diff --git a/tests/rustdoc/issue-29503.rs b/tests/rustdoc/issue-29503.rs deleted file mode 100644 index 310acd09a82..00000000000 --- a/tests/rustdoc/issue-29503.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![crate_name="issue_29503"] - -use std::fmt; - -// @has issue_29503/trait.MyTrait.html -pub trait MyTrait { - fn my_string(&self) -> String; -} - -// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header']" "impl MyTrait for Twhere T: Debug" -impl MyTrait for T -where - T: fmt::Debug, -{ - fn my_string(&self) -> String { - format!("{:?}", self) - } -} - -pub fn main() {} diff --git a/tests/rustdoc/issue-29584.rs b/tests/rustdoc/issue-29584.rs deleted file mode 100644 index 6e3feafc7ad..00000000000 --- a/tests/rustdoc/issue-29584.rs +++ /dev/null @@ -1,10 +0,0 @@ -// aux-build:issue-29584.rs -// ignore-cross-compile - -#![crate_name="issue_29584"] - -extern crate issue_29584; - -// @has issue_29584/struct.Foo.html -// @!hasraw - 'impl Bar for' -pub use issue_29584::Foo; diff --git a/tests/rustdoc/issue-30109.rs b/tests/rustdoc/issue-30109.rs deleted file mode 100644 index ff9a22b5f7b..00000000000 --- a/tests/rustdoc/issue-30109.rs +++ /dev/null @@ -1,16 +0,0 @@ -// build-aux-docs -// aux-build:issue-30109-1.rs -// ignore-cross-compile - -#![crate_name="issue_30109"] - -pub mod quux { - extern crate issue_30109_1 as bar; - use self::bar::Bar; - - pub trait Foo {} - - // @has issue_30109/quux/trait.Foo.html \ - // '//a/@href' '../issue_30109_1/struct.Bar.html' - impl Foo for Bar {} -} diff --git a/tests/rustdoc/issue-30252.rs b/tests/rustdoc/issue-30252.rs deleted file mode 100644 index 749c63d741c..00000000000 --- a/tests/rustdoc/issue-30252.rs +++ /dev/null @@ -1,8 +0,0 @@ -// compile-flags:--test --cfg feature="bar" - -#![crate_name="issue_30252"] - -/// ```rust -/// assert_eq!(cfg!(feature = "bar"), true); -/// ``` -pub fn foo() {} diff --git a/tests/rustdoc/issue-30366.rs b/tests/rustdoc/issue-30366.rs deleted file mode 100644 index 0fa5dc6fe7f..00000000000 --- a/tests/rustdoc/issue-30366.rs +++ /dev/null @@ -1,8 +0,0 @@ -// @has issue_30366/index.html '//a/@href' 'http://www.rust-lang.org/' - -#![crate_name="issue_30366"] - -/// Describe it. [Link somewhere][1]. -/// -/// [1]: http://www.rust-lang.org/ -pub fn here_is_a_fn() { } diff --git a/tests/rustdoc/issue-31808.rs b/tests/rustdoc/issue-31808.rs deleted file mode 100644 index 58f9daaff59..00000000000 --- a/tests/rustdoc/issue-31808.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Test that associated item impls on primitive types don't crash rustdoc - -#![crate_name="issue_31808"] - -pub trait Foo { - const BAR: usize; - type BAZ; -} - -impl Foo for () { - const BAR: usize = 0; - type BAZ = usize; -} diff --git a/tests/rustdoc/issue-31899.rs b/tests/rustdoc/issue-31899.rs deleted file mode 100644 index 570ab59bbe9..00000000000 --- a/tests/rustdoc/issue-31899.rs +++ /dev/null @@ -1,61 +0,0 @@ -#![crate_name="issue_31899"] - -// @has issue_31899/index.html -// @hasraw - 'Make this line a bit longer.' -// @!hasraw - 'rust rust-example-rendered' -// @!hasraw - 'use ndarray::arr2' -// @!hasraw - 'prohibited' - -/// A tuple or fixed size array that can be used to index an array. -/// Make this line a bit longer. -/// -/// ``` -/// use ndarray::arr2; -/// -/// let mut a = arr2(&[[0, 1], [0, 0]]); -/// a[[1, 1]] = 1; -/// assert_eq!(a[[0, 1]], 1); -/// assert_eq!(a[[1, 1]], 1); -/// ``` -/// -/// **Note** the blanket implementation that's not visible in rustdoc: -/// `impl NdIndex for D where D: Dimension { ... }` -pub fn bar() {} - -/// Some line -/// -/// # prohibited -pub fn foo() {} - -/// Some line -/// -/// 1. prohibited -/// 2. bar -pub fn baz() {} - -/// Some line -/// -/// - prohibited -/// - bar -pub fn qux() {} - -/// Some line -/// -/// * prohibited -/// * bar -pub fn quz() {} - -/// Some line -/// -/// > prohibited -/// > bar -pub fn qur() {} - -/// Some line -/// -/// prohibited -/// ===== -/// -/// Second -/// ------ -pub fn qut() {} diff --git a/tests/rustdoc/issue-32077-type-alias-impls.rs b/tests/rustdoc/issue-32077-type-alias-impls.rs deleted file mode 100644 index 664b678093e..00000000000 --- a/tests/rustdoc/issue-32077-type-alias-impls.rs +++ /dev/null @@ -1,66 +0,0 @@ -// Regression test for . - -#![crate_name = "foo"] - -pub struct GenericStruct(T); - -impl GenericStruct { - pub fn on_gen(arg: T) {} -} - -impl GenericStruct { - pub fn on_u32(arg: u32) {} -} - -pub trait Foo {} -pub trait Bar {} - -impl Foo for GenericStruct {} -impl Bar for GenericStruct {} - -// @has 'foo/type.TypedefStruct.html' -// We check that "Aliased type" is also present as a title in the sidebar. -// @has - '//*[@class="sidebar-elems"]//h3/a[@href="#aliased-type"]' 'Aliased type' -// We check that we have the implementation of the type alias itself. -// @has - '//*[@id="impl-GenericStruct%3Cu8%3E"]/h3' 'impl TypedefStruct' -// @has - '//*[@id="method.on_alias"]/h4' 'pub fn on_alias()' -// @has - '//*[@id="impl-GenericStruct%3CT%3E"]/h3' 'impl GenericStruct' -// @has - '//*[@id="method.on_gen"]/h4' 'pub fn on_gen(arg: T)' -// @has - '//*[@id="impl-Foo-for-GenericStruct%3CT%3E"]/h3' 'impl Foo for GenericStruct' -// This trait implementation doesn't match the type alias parameters so shouldn't appear in docs. -// @!has - '//h3' 'impl Bar for GenericStruct {}' -// Same goes for the `Deref` impl. -// @!has - '//h2' 'Methods from Deref' -// @count - '//nav[@class="sidebar"]//a' 'on_alias' 1 -// @count - '//nav[@class="sidebar"]//a' 'on_gen' 1 -// @count - '//nav[@class="sidebar"]//a' 'Foo' 1 -// @!has - '//nav[@class="sidebar"]//a' 'Bar' -// @!has - '//nav[@class="sidebar"]//a' 'on_u32' -pub type TypedefStruct = GenericStruct; - -impl TypedefStruct { - pub fn on_alias() {} -} - -impl std::ops::Deref for GenericStruct { - type Target = u32; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -pub struct Wrap(GenericStruct); - -// @has 'foo/type.Alias.html' -// @has - '//h2' 'Methods from Deref' -// @has - '//*[@id="impl-Deref-for-Wrap%3CT%3E"]/h3' 'impl Deref for Wrap' -pub type Alias = Wrap; - -impl std::ops::Deref for Wrap { - type Target = GenericStruct; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} diff --git a/tests/rustdoc/issue-32374.rs b/tests/rustdoc/issue-32374.rs deleted file mode 100644 index 36070dbb731..00000000000 --- a/tests/rustdoc/issue-32374.rs +++ /dev/null @@ -1,32 +0,0 @@ -#![feature(staged_api)] -#![doc(issue_tracker_base_url = "https://issue_url/")] -#![unstable(feature = "test", issue = "32374")] -#![crate_name="issue_32374"] - -// @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \ -// 'Deprecated' -// @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab unstable"]' \ -// 'Experimental' -// @matches issue_32374/index.html '//*[@class="desc docblock-short"]/text()' 'Docs' - -// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' '👎' -// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' \ -// 'Deprecated since 1.0.0: text' -// @hasraw - 'test #32374' -// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' '🔬' -// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \ -// 'This is a nightly-only experimental API. \(test\s#32374\)$' -/// Docs -#[deprecated(since = "1.0.0", note = "text")] -#[unstable(feature = "test", issue = "32374")] -pub struct T; - -// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' '👎' -// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' \ -// 'Deprecated since 1.0.0: deprecated' -// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' '🔬' -// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \ -// 'This is a nightly-only experimental API. (test #32374)' -#[deprecated(since = "1.0.0", note = "deprecated")] -#[unstable(feature = "test", issue = "32374", reason = "unstable")] -pub struct U; diff --git a/tests/rustdoc/issue-32395.rs b/tests/rustdoc/issue-32395.rs deleted file mode 100644 index d419c75b71c..00000000000 --- a/tests/rustdoc/issue-32395.rs +++ /dev/null @@ -1,17 +0,0 @@ -// aux-build:variant-struct.rs -// build-aux-docs -// ignore-cross-compile - -#![crate_name="issue_32395"] - -// @has variant_struct/enum.Foo.html -// @!hasraw - 'pub qux' -// @!hasraw - 'pub(crate) qux' -// @!hasraw - 'pub Bar' -extern crate variant_struct; - -// @has issue_32395/enum.Foo.html -// @!hasraw - 'pub qux' -// @!hasraw - 'pub(crate) qux' -// @!hasraw - 'pub Bar' -pub use variant_struct::Foo; diff --git a/tests/rustdoc/issue-32556.rs b/tests/rustdoc/issue-32556.rs deleted file mode 100644 index 369aef72e19..00000000000 --- a/tests/rustdoc/issue-32556.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_name="issue_32556"] - -/// Blah blah blah -/// ```ignore (testing rustdoc's handling of ignore) -/// bad_assert!(); -/// ``` -pub fn foo() {} diff --git a/tests/rustdoc/issue-32890.rs b/tests/rustdoc/issue-32890.rs deleted file mode 100644 index dfac0ef22b7..00000000000 --- a/tests/rustdoc/issue-32890.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![crate_name="issue_32890"] - -// @has issue_32890/struct.Foo.html -pub struct Foo(T); - -impl Foo { - // @has - '//a[@href="#method.pass"]' 'pass' - pub fn pass() {} -} - -impl Foo { - // @has - '//a[@href="#method.pass-1"]' 'pass' - pub fn pass() {} -} - -impl Foo { - // @has - '//a[@href="#method.pass-2"]' 'pass' - pub fn pass() {} -} diff --git a/tests/rustdoc/issue-33069.rs b/tests/rustdoc/issue-33069.rs deleted file mode 100644 index 9c0e0014bd1..00000000000 --- a/tests/rustdoc/issue-33069.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_name="issue_33069"] - -pub trait Bar {} - -#[doc(hidden)] -pub mod hidden { - pub struct Foo; -} - -// @has issue_33069/trait.Bar.html -// @!has - '//code' 'impl Bar for Foo' -impl Bar for hidden::Foo {} diff --git a/tests/rustdoc/issue-33178-1.rs b/tests/rustdoc/issue-33178-1.rs deleted file mode 100644 index 24740c12952..00000000000 --- a/tests/rustdoc/issue-33178-1.rs +++ /dev/null @@ -1,12 +0,0 @@ -// aux-build:empty.rs -// aux-build:variant-struct.rs -// ignore-cross-compile - -#![crate_name="issue_33178_1"] - -// @has issue_33178_1/index.html -// @!has - //a/@title empty -pub extern crate empty; - -// @!has - //a/@title variant_struct -pub extern crate variant_struct as foo; diff --git a/tests/rustdoc/issue-33178.rs b/tests/rustdoc/issue-33178.rs deleted file mode 100644 index fb44d8efc8c..00000000000 --- a/tests/rustdoc/issue-33178.rs +++ /dev/null @@ -1,16 +0,0 @@ -// aux-build:empty.rs -// aux-build:variant-struct.rs -// build-aux-docs -// ignore-cross-compile - -#![crate_name="issue_33178"] - -// @has issue_33178/index.html -// @has - '//a[@title="mod empty"][@href="../empty/index.html"]' empty -pub extern crate empty; - -// @has - '//a[@title="mod variant_struct"][@href="../variant_struct/index.html"]' variant_struct -pub extern crate variant_struct as foo; - -// @has - '//a[@title="mod issue_33178"][@href="index.html"]' self -pub extern crate self as bar; diff --git a/tests/rustdoc/issue-33302.rs b/tests/rustdoc/issue-33302.rs deleted file mode 100644 index b4e6cc7aaac..00000000000 --- a/tests/rustdoc/issue-33302.rs +++ /dev/null @@ -1,53 +0,0 @@ -#![crate_name="issue_33302"] - -// Ensure constant and array length values are not taken from source -// code, which wreaks havoc with macros. - -macro_rules! make { - ($n:expr) => { - pub struct S; - - // @has issue_33302/constant.CST.html \ - // '//pre[@class="rust item-decl"]' 'pub const CST: i32' - pub const CST: i32 = ($n * $n); - // @has issue_33302/static.ST.html \ - // '//pre[@class="rust item-decl"]' 'pub static ST: i32' - pub static ST: i32 = ($n * $n); - - pub trait T { - fn ignore(_: &X) {} - const C: X; - // @has issue_33302/trait.T.html \ - // '//pre[@class="rust item-decl"]' 'const D: i32' - // @has - '//*[@id="associatedconstant.D"]' 'const D: i32' - const D: i32 = ($n * $n); - } - - // @has issue_33302/struct.S.html \ - // '//*[@class="impl"]' 'impl T<[i32; 16]> for S' - // @has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16]' - // @has - '//*[@id="associatedconstant.D"]' 'const D: i32' - impl T<[i32; ($n * $n)]> for S { - const C: [i32; ($n * $n)] = [0; ($n * $n)]; - } - - // @has issue_33302/struct.S.html \ - // '//*[@class="impl"]' 'impl T<[i32; 16]> for S' - // @has - '//*[@id="associatedconstant.C-1"]' 'const C: (i32,)' - // @has - '//*[@id="associatedconstant.D-1"]' 'const D: i32' - impl T<(i32,)> for S { - const C: (i32,) = ($n,); - } - - // @has issue_33302/struct.S.html \ - // '//*[@class="impl"]' 'impl T<(i32, i32)> for S' - // @has - '//*[@id="associatedconstant.C-2"]' 'const C: (i32, i32)' - // @has - '//*[@id="associatedconstant.D-2"]' 'const D: i32' - impl T<(i32, i32)> for S { - const C: (i32, i32) = ($n, $n); - const D: i32 = ($n / $n); - } - }; -} - -make!(4); diff --git a/tests/rustdoc/issue-33592.rs b/tests/rustdoc/issue-33592.rs deleted file mode 100644 index 7a128f0b897..00000000000 --- a/tests/rustdoc/issue-33592.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_name = "foo"] - -pub trait Foo {} - -pub struct Bar; - -pub struct Baz; - -// @has foo/trait.Foo.html '//h3[@class="code-header"]' 'impl Foo for Bar' -impl Foo for Bar {} - -// @has foo/trait.Foo.html '//h3[@class="code-header"]' 'impl Foo for Baz' -impl Foo for Baz {} diff --git a/tests/rustdoc/issue-34025.rs b/tests/rustdoc/issue-34025.rs deleted file mode 100644 index 9b9f21cb316..00000000000 --- a/tests/rustdoc/issue-34025.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_name = "foo"] - -// @!has 'foo/sys/index.html' -// @!has 'foo/sys/sidebar-items.js' -#[doc(hidden)] -pub mod sys { - extern "C" { - // @!has 'foo/sys/fn.foo.html' - #[doc(hidden)] - pub fn foo(); - } -} diff --git a/tests/rustdoc/issue-34274.rs b/tests/rustdoc/issue-34274.rs deleted file mode 100644 index ce5be84a549..00000000000 --- a/tests/rustdoc/issue-34274.rs +++ /dev/null @@ -1,10 +0,0 @@ -// aux-build:issue-34274.rs -// build-aux-docs -// ignore-cross-compile - -#![crate_name = "foo"] - -extern crate issue_34274; - -// @has foo/fn.extern_c_fn.html '//a/@href' '../src/issue_34274/issue-34274.rs.html#2' -pub use issue_34274::extern_c_fn; diff --git a/tests/rustdoc/link-extern-crate-33178.rs b/tests/rustdoc/link-extern-crate-33178.rs new file mode 100644 index 00000000000..fb44d8efc8c --- /dev/null +++ b/tests/rustdoc/link-extern-crate-33178.rs @@ -0,0 +1,16 @@ +// aux-build:empty.rs +// aux-build:variant-struct.rs +// build-aux-docs +// ignore-cross-compile + +#![crate_name="issue_33178"] + +// @has issue_33178/index.html +// @has - '//a[@title="mod empty"][@href="../empty/index.html"]' empty +pub extern crate empty; + +// @has - '//a[@title="mod variant_struct"][@href="../variant_struct/index.html"]' variant_struct +pub extern crate variant_struct as foo; + +// @has - '//a[@title="mod issue_33178"][@href="index.html"]' self +pub extern crate self as bar; diff --git a/tests/rustdoc/link-extern-crate-item-30109.rs b/tests/rustdoc/link-extern-crate-item-30109.rs new file mode 100644 index 00000000000..ff9a22b5f7b --- /dev/null +++ b/tests/rustdoc/link-extern-crate-item-30109.rs @@ -0,0 +1,16 @@ +// build-aux-docs +// aux-build:issue-30109-1.rs +// ignore-cross-compile + +#![crate_name="issue_30109"] + +pub mod quux { + extern crate issue_30109_1 as bar; + use self::bar::Bar; + + pub trait Foo {} + + // @has issue_30109/quux/trait.Foo.html \ + // '//a/@href' '../issue_30109_1/struct.Bar.html' + impl Foo for Bar {} +} diff --git a/tests/rustdoc/link-extern-crate-title-33178.rs b/tests/rustdoc/link-extern-crate-title-33178.rs new file mode 100644 index 00000000000..24740c12952 --- /dev/null +++ b/tests/rustdoc/link-extern-crate-title-33178.rs @@ -0,0 +1,12 @@ +// aux-build:empty.rs +// aux-build:variant-struct.rs +// ignore-cross-compile + +#![crate_name="issue_33178_1"] + +// @has issue_33178_1/index.html +// @!has - //a/@title empty +pub extern crate empty; + +// @!has - //a/@title variant_struct +pub extern crate variant_struct as foo; diff --git a/tests/rustdoc/render-enum-variant-structlike-32395.rs b/tests/rustdoc/render-enum-variant-structlike-32395.rs new file mode 100644 index 00000000000..d419c75b71c --- /dev/null +++ b/tests/rustdoc/render-enum-variant-structlike-32395.rs @@ -0,0 +1,17 @@ +// aux-build:variant-struct.rs +// build-aux-docs +// ignore-cross-compile + +#![crate_name="issue_32395"] + +// @has variant_struct/enum.Foo.html +// @!hasraw - 'pub qux' +// @!hasraw - 'pub(crate) qux' +// @!hasraw - 'pub Bar' +extern crate variant_struct; + +// @has issue_32395/enum.Foo.html +// @!hasraw - 'pub qux' +// @!hasraw - 'pub(crate) qux' +// @!hasraw - 'pub Bar' +pub use variant_struct::Foo; diff --git a/tests/rustdoc/src-links-inlined-34274.rs b/tests/rustdoc/src-links-inlined-34274.rs new file mode 100644 index 00000000000..ce5be84a549 --- /dev/null +++ b/tests/rustdoc/src-links-inlined-34274.rs @@ -0,0 +1,10 @@ +// aux-build:issue-34274.rs +// build-aux-docs +// ignore-cross-compile + +#![crate_name = "foo"] + +extern crate issue_34274; + +// @has foo/fn.extern_c_fn.html '//a/@href' '../src/issue_34274/issue-34274.rs.html#2' +pub use issue_34274::extern_c_fn; diff --git a/tests/rustdoc/staged-api-deprecated-unstable-32374.rs b/tests/rustdoc/staged-api-deprecated-unstable-32374.rs new file mode 100644 index 00000000000..36070dbb731 --- /dev/null +++ b/tests/rustdoc/staged-api-deprecated-unstable-32374.rs @@ -0,0 +1,32 @@ +#![feature(staged_api)] +#![doc(issue_tracker_base_url = "https://issue_url/")] +#![unstable(feature = "test", issue = "32374")] +#![crate_name="issue_32374"] + +// @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \ +// 'Deprecated' +// @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab unstable"]' \ +// 'Experimental' +// @matches issue_32374/index.html '//*[@class="desc docblock-short"]/text()' 'Docs' + +// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' '👎' +// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' \ +// 'Deprecated since 1.0.0: text' +// @hasraw - 'test #32374' +// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' '🔬' +// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \ +// 'This is a nightly-only experimental API. \(test\s#32374\)$' +/// Docs +#[deprecated(since = "1.0.0", note = "text")] +#[unstable(feature = "test", issue = "32374")] +pub struct T; + +// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' '👎' +// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' \ +// 'Deprecated since 1.0.0: deprecated' +// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' '🔬' +// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \ +// 'This is a nightly-only experimental API. (test #32374)' +#[deprecated(since = "1.0.0", note = "deprecated")] +#[unstable(feature = "test", issue = "32374", reason = "unstable")] +pub struct U; diff --git a/tests/rustdoc/summary-codeblock-31899.rs b/tests/rustdoc/summary-codeblock-31899.rs new file mode 100644 index 00000000000..570ab59bbe9 --- /dev/null +++ b/tests/rustdoc/summary-codeblock-31899.rs @@ -0,0 +1,61 @@ +#![crate_name="issue_31899"] + +// @has issue_31899/index.html +// @hasraw - 'Make this line a bit longer.' +// @!hasraw - 'rust rust-example-rendered' +// @!hasraw - 'use ndarray::arr2' +// @!hasraw - 'prohibited' + +/// A tuple or fixed size array that can be used to index an array. +/// Make this line a bit longer. +/// +/// ``` +/// use ndarray::arr2; +/// +/// let mut a = arr2(&[[0, 1], [0, 0]]); +/// a[[1, 1]] = 1; +/// assert_eq!(a[[0, 1]], 1); +/// assert_eq!(a[[1, 1]], 1); +/// ``` +/// +/// **Note** the blanket implementation that's not visible in rustdoc: +/// `impl NdIndex for D where D: Dimension { ... }` +pub fn bar() {} + +/// Some line +/// +/// # prohibited +pub fn foo() {} + +/// Some line +/// +/// 1. prohibited +/// 2. bar +pub fn baz() {} + +/// Some line +/// +/// - prohibited +/// - bar +pub fn qux() {} + +/// Some line +/// +/// * prohibited +/// * bar +pub fn quz() {} + +/// Some line +/// +/// > prohibited +/// > bar +pub fn qur() {} + +/// Some line +/// +/// prohibited +/// ===== +/// +/// Second +/// ------ +pub fn qut() {} diff --git a/tests/rustdoc/summary-reference-link-30366.rs b/tests/rustdoc/summary-reference-link-30366.rs new file mode 100644 index 00000000000..0fa5dc6fe7f --- /dev/null +++ b/tests/rustdoc/summary-reference-link-30366.rs @@ -0,0 +1,8 @@ +// @has issue_30366/index.html '//a/@href' 'http://www.rust-lang.org/' + +#![crate_name="issue_30366"] + +/// Describe it. [Link somewhere][1]. +/// +/// [1]: http://www.rust-lang.org/ +pub fn here_is_a_fn() { } diff --git a/tests/rustdoc/type-alias-impls-32077.rs b/tests/rustdoc/type-alias-impls-32077.rs new file mode 100644 index 00000000000..664b678093e --- /dev/null +++ b/tests/rustdoc/type-alias-impls-32077.rs @@ -0,0 +1,66 @@ +// Regression test for . + +#![crate_name = "foo"] + +pub struct GenericStruct(T); + +impl GenericStruct { + pub fn on_gen(arg: T) {} +} + +impl GenericStruct { + pub fn on_u32(arg: u32) {} +} + +pub trait Foo {} +pub trait Bar {} + +impl Foo for GenericStruct {} +impl Bar for GenericStruct {} + +// @has 'foo/type.TypedefStruct.html' +// We check that "Aliased type" is also present as a title in the sidebar. +// @has - '//*[@class="sidebar-elems"]//h3/a[@href="#aliased-type"]' 'Aliased type' +// We check that we have the implementation of the type alias itself. +// @has - '//*[@id="impl-GenericStruct%3Cu8%3E"]/h3' 'impl TypedefStruct' +// @has - '//*[@id="method.on_alias"]/h4' 'pub fn on_alias()' +// @has - '//*[@id="impl-GenericStruct%3CT%3E"]/h3' 'impl GenericStruct' +// @has - '//*[@id="method.on_gen"]/h4' 'pub fn on_gen(arg: T)' +// @has - '//*[@id="impl-Foo-for-GenericStruct%3CT%3E"]/h3' 'impl Foo for GenericStruct' +// This trait implementation doesn't match the type alias parameters so shouldn't appear in docs. +// @!has - '//h3' 'impl Bar for GenericStruct {}' +// Same goes for the `Deref` impl. +// @!has - '//h2' 'Methods from Deref' +// @count - '//nav[@class="sidebar"]//a' 'on_alias' 1 +// @count - '//nav[@class="sidebar"]//a' 'on_gen' 1 +// @count - '//nav[@class="sidebar"]//a' 'Foo' 1 +// @!has - '//nav[@class="sidebar"]//a' 'Bar' +// @!has - '//nav[@class="sidebar"]//a' 'on_u32' +pub type TypedefStruct = GenericStruct; + +impl TypedefStruct { + pub fn on_alias() {} +} + +impl std::ops::Deref for GenericStruct { + type Target = u32; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +pub struct Wrap(GenericStruct); + +// @has 'foo/type.Alias.html' +// @has - '//h2' 'Methods from Deref' +// @has - '//*[@id="impl-Deref-for-Wrap%3CT%3E"]/h3' 'impl Deref for Wrap' +pub type Alias = Wrap; + +impl std::ops::Deref for Wrap { + type Target = GenericStruct; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} -- cgit 1.4.1-3-g733a5