From cf2dff2b1e3fa55fa5415d524200070d0d7aacfe Mon Sep 17 00:00:00 2001 From: Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> Date: Thu, 5 Jan 2023 09:13:28 +0100 Subject: Move /src/test to /tests --- tests/rustdoc-gui/src/lib2/Cargo.lock | 22 ++ tests/rustdoc-gui/src/lib2/Cargo.toml | 11 + tests/rustdoc-gui/src/lib2/another_folder/mod.rs | 3 + .../src/lib2/another_folder/sub_mod/mod.rs | 1 + tests/rustdoc-gui/src/lib2/another_mod/mod.rs | 1 + tests/rustdoc-gui/src/lib2/http/Cargo.toml | 7 + tests/rustdoc-gui/src/lib2/http/lib.rs | 1 + tests/rustdoc-gui/src/lib2/implementors/Cargo.lock | 7 + tests/rustdoc-gui/src/lib2/implementors/Cargo.toml | 10 + tests/rustdoc-gui/src/lib2/implementors/lib.rs | 22 ++ tests/rustdoc-gui/src/lib2/lib.rs | 343 +++++++++++++++++++++ 11 files changed, 428 insertions(+) create mode 100644 tests/rustdoc-gui/src/lib2/Cargo.lock create mode 100644 tests/rustdoc-gui/src/lib2/Cargo.toml create mode 100644 tests/rustdoc-gui/src/lib2/another_folder/mod.rs create mode 100644 tests/rustdoc-gui/src/lib2/another_folder/sub_mod/mod.rs create mode 100644 tests/rustdoc-gui/src/lib2/another_mod/mod.rs create mode 100644 tests/rustdoc-gui/src/lib2/http/Cargo.toml create mode 100644 tests/rustdoc-gui/src/lib2/http/lib.rs create mode 100644 tests/rustdoc-gui/src/lib2/implementors/Cargo.lock create mode 100644 tests/rustdoc-gui/src/lib2/implementors/Cargo.toml create mode 100644 tests/rustdoc-gui/src/lib2/implementors/lib.rs create mode 100644 tests/rustdoc-gui/src/lib2/lib.rs (limited to 'tests/rustdoc-gui/src/lib2') diff --git a/tests/rustdoc-gui/src/lib2/Cargo.lock b/tests/rustdoc-gui/src/lib2/Cargo.lock new file mode 100644 index 00000000000..425a3ae7e5c --- /dev/null +++ b/tests/rustdoc-gui/src/lib2/Cargo.lock @@ -0,0 +1,22 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "http" +version = "0.1.0" + +[[package]] +name = "implementors" +version = "0.1.0" +dependencies = [ + "http", +] + +[[package]] +name = "lib2" +version = "0.1.0" +dependencies = [ + "http", + "implementors", +] diff --git a/tests/rustdoc-gui/src/lib2/Cargo.toml b/tests/rustdoc-gui/src/lib2/Cargo.toml new file mode 100644 index 00000000000..8bca77ff834 --- /dev/null +++ b/tests/rustdoc-gui/src/lib2/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "lib2" +version = "0.1.0" +edition = "2018" + +[lib] +path = "lib.rs" + +[dependencies] +implementors = { path = "./implementors" } +http = { path = "./http" } diff --git a/tests/rustdoc-gui/src/lib2/another_folder/mod.rs b/tests/rustdoc-gui/src/lib2/another_folder/mod.rs new file mode 100644 index 00000000000..ec9a2085924 --- /dev/null +++ b/tests/rustdoc-gui/src/lib2/another_folder/mod.rs @@ -0,0 +1,3 @@ +pub fn another_fn() {} + +pub mod sub_mod; diff --git a/tests/rustdoc-gui/src/lib2/another_folder/sub_mod/mod.rs b/tests/rustdoc-gui/src/lib2/another_folder/sub_mod/mod.rs new file mode 100644 index 00000000000..f16722cf35b --- /dev/null +++ b/tests/rustdoc-gui/src/lib2/another_folder/sub_mod/mod.rs @@ -0,0 +1 @@ +pub fn subsubsub() {} diff --git a/tests/rustdoc-gui/src/lib2/another_mod/mod.rs b/tests/rustdoc-gui/src/lib2/another_mod/mod.rs new file mode 100644 index 00000000000..9a4f007a2f0 --- /dev/null +++ b/tests/rustdoc-gui/src/lib2/another_mod/mod.rs @@ -0,0 +1 @@ +pub fn tadam() {} diff --git a/tests/rustdoc-gui/src/lib2/http/Cargo.toml b/tests/rustdoc-gui/src/lib2/http/Cargo.toml new file mode 100644 index 00000000000..fa719efa526 --- /dev/null +++ b/tests/rustdoc-gui/src/lib2/http/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "http" +version = "0.1.0" +edition = "2018" + +[lib] +path = "lib.rs" diff --git a/tests/rustdoc-gui/src/lib2/http/lib.rs b/tests/rustdoc-gui/src/lib2/http/lib.rs new file mode 100644 index 00000000000..204e0749427 --- /dev/null +++ b/tests/rustdoc-gui/src/lib2/http/lib.rs @@ -0,0 +1 @@ +pub trait HttpTrait {} diff --git a/tests/rustdoc-gui/src/lib2/implementors/Cargo.lock b/tests/rustdoc-gui/src/lib2/implementors/Cargo.lock new file mode 100644 index 00000000000..cad99a991a2 --- /dev/null +++ b/tests/rustdoc-gui/src/lib2/implementors/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "implementors" +version = "0.1.0" diff --git a/tests/rustdoc-gui/src/lib2/implementors/Cargo.toml b/tests/rustdoc-gui/src/lib2/implementors/Cargo.toml new file mode 100644 index 00000000000..9dafc43df5f --- /dev/null +++ b/tests/rustdoc-gui/src/lib2/implementors/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "implementors" +version = "0.1.0" +edition = "2018" + +[lib] +path = "lib.rs" + +[dependencies] +http = { path = "../http/" } diff --git a/tests/rustdoc-gui/src/lib2/implementors/lib.rs b/tests/rustdoc-gui/src/lib2/implementors/lib.rs new file mode 100644 index 00000000000..2842ac50dc1 --- /dev/null +++ b/tests/rustdoc-gui/src/lib2/implementors/lib.rs @@ -0,0 +1,22 @@ +pub trait Whatever { + type Foo; + + fn method() {} +} + +pub struct Struct; + +impl Whatever for Struct { + type Foo = u8; +} + +impl http::HttpTrait for Struct {} + +mod traits { + pub trait TraitToReexport { + fn method() {} + } +} + +#[doc(inline)] +pub use traits::TraitToReexport; diff --git a/tests/rustdoc-gui/src/lib2/lib.rs b/tests/rustdoc-gui/src/lib2/lib.rs new file mode 100644 index 00000000000..34e67d9d254 --- /dev/null +++ b/tests/rustdoc-gui/src/lib2/lib.rs @@ -0,0 +1,343 @@ +// ignore-tidy-linelength + +#![feature(doc_cfg)] + +pub mod another_folder; +pub mod another_mod; + +pub mod module { + pub mod sub_module { + pub mod sub_sub_module { + pub fn foo() {} + } + pub fn bar() {} + } + pub fn whatever() {} +} + +pub fn foobar() {} + +pub type Alias = u32; + +#[doc(cfg(feature = "foo-method"))] +pub struct Foo { + pub x: Alias, +} + +impl Foo { + /// Some documentation + /// # A Heading + pub fn a_method(&self) {} +} + +#[doc(cfg(feature = "foo-method"))] +#[deprecated = "Whatever [`Foo::a_method`](#method.a_method)"] +pub trait Trait { + type X; + const Y: u32; + + #[deprecated = "Whatever [`Foo`](#tadam)"] + fn foo() {} + fn fooo(); +} + +impl Trait for Foo { + type X = u32; + const Y: u32 = 0; + + fn fooo() {} +} + +impl implementors::Whatever for Foo { + type Foo = u32; +} + +#[doc(inline)] +pub use implementors::TraitToReexport; + +pub struct StructToImplOnReexport; + +impl TraitToReexport for StructToImplOnReexport {} + +pub mod sub_mod { + /// ```txt + /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + /// ``` + /// + /// ``` + /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + /// ``` + pub struct Foo; +} + +pub mod long_trait { + use std::ops::DerefMut; + + pub trait ALongNameBecauseItHelpsTestingTheCurrentProblem: + DerefMut + From + Send + Sync + AsRef + 'static + { + } +} + +pub mod long_table { + /// | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two | + /// | ----------- | ----------- | ----------- | ----------- | + /// | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two | + /// + /// I wanna sqdkfnqds f dsqf qds f dsqf dsq f dsq f qds f qds f qds f dsqq f dsf sqdf dsq fds f dsq f dq f ds fq sd fqds f dsq f sqd fsq df sd fdsqfqsd fdsq f dsq f dsqfd s dfq + pub struct Foo; + + /// | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two | + /// | ----------- | ----------- | ----------- | ----------- | + /// | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two | + /// + /// I wanna sqdkfnqds f dsqf qds f dsqf dsq f dsq f qds f qds f qds f dsqq f dsf sqdf dsq fds f dsq f dq f ds fq sd fqds f dsq f sqd fsq df sd fdsqfqsd fdsq f dsq f dsqfd s dfq + impl Foo { + pub fn foo(&self) {} + } +} + +pub mod summary_table { + /// | header 1 | header 2 | + /// | -------- | -------- | + /// | content | content | + pub struct Foo; +} + +pub mod too_long { + pub type ReallyLongTypeNameLongLongLong = + Option *const u8>; + + pub const ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong: u32 = 0; + + /// This also has a really long doccomment. Lorem ipsum dolor sit amet, + /// consectetur adipiscing elit. Suspendisse id nibh malesuada, hendrerit + /// massa vel, tincidunt est. Nulla interdum, sem ac efficitur ornare, arcu + /// nunc dignissim nibh, at rutrum diam augue ac mauris. Fusce tincidunt et + /// ligula sed viverra. Aenean sed facilisis dui, non volutpat felis. In + /// vitae est dui. Donec felis nibh, blandit at nibh eu, tempor suscipit + /// nisl. Vestibulum ornare porta libero, eu faucibus purus iaculis ut. Ut + /// quis tincidunt nunc, in mollis purus. Nulla sed interdum quam. Nunc + /// vitae cursus ex. + pub struct SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { + pub a: u32, + } + + impl SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { + /// ``` + /// let x = SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { a: 0 }; + /// ``` + pub fn foo(&self) {} + } +} + +pub struct HasALongTraitWithParams {} + +pub trait LongTraitWithParamsBananaBananaBanana {} + +impl LongTraitWithParamsBananaBananaBanana for HasALongTraitWithParams {} + +#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))] +pub struct LongItemInfo; + +pub trait SimpleTrait {} +pub struct LongItemInfo2; + +/// Some docs. +#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))] +impl SimpleTrait for LongItemInfo2 {} + +pub struct WhereWhitespace; + +impl WhereWhitespace { + pub fn new(f: F) -> Self + where + F: FnMut() -> i32, + {} +} + +impl Whitespace<&K> for WhereWhitespace +where + K: std::fmt::Debug, +{ + type Output = WhereWhitespace; + fn index(&self, _key: &K) -> &Self::Output { + self + } +} + +pub trait Whitespace +where + Idx: ?Sized, +{ + type Output; + fn index(&self, index: Idx) -> &Self::Output; +} + +pub struct ItemInfoAlignmentTest; + +impl ItemInfoAlignmentTest { + /// This method has docs + #[deprecated] + pub fn foo() {} + #[deprecated] + pub fn bar() {} +} + +pub mod scroll_traits { + use std::iter::*; + + /// Shamelessly (partially) copied from `std::iter::Iterator`. + /// It allows us to check that the scroll is working as expected on "hidden" items. + pub trait Iterator { + type Item; + + fn next(&mut self) -> Option; + fn size_hint(&self) -> (usize, Option); + fn count(self) -> usize + where + Self: Sized; + fn last(self) -> Option + where + Self: Sized; + fn advance_by(&mut self, n: usize) -> Result<(), usize>; + fn nth(&mut self, n: usize) -> Option; + fn step_by(self, step: usize) -> StepBy + where + Self: Sized; + fn chain(self, other: U) -> Chain + where + Self: Sized, + U: IntoIterator; + fn zip(self, other: U) -> Zip + where + Self: Sized, + U: IntoIterator; + fn intersperse(self, separator: Self::Item) -> Intersperse + where + Self: Sized, + Self::Item: Clone; + fn intersperse_with(self, separator: G) -> IntersperseWith + where + Self: Sized, + G: FnMut() -> Self::Item; + fn map(self, f: F) -> Map + where + Self: Sized, + F: FnMut(Self::Item) -> B; + fn for_each(self, f: F) + where + Self: Sized, + F: FnMut(Self::Item); + fn filter

(self, predicate: P) -> Filter + where + Self: Sized, + P: FnMut(&Self::Item) -> bool; + fn filter_map(self, f: F) -> FilterMap + where + Self: Sized, + F: FnMut(Self::Item) -> Option; + fn enumerate(self) -> Enumerate + where + Self: Sized; + fn peekable(self) -> Peekable + where + Self: Sized; + fn skip_while

(self, predicate: P) -> SkipWhile + where + Self: Sized, + P: FnMut(&Self::Item) -> bool; + fn take_while

(self, predicate: P) -> TakeWhile + where + Self: Sized, + P: FnMut(&Self::Item) -> bool; + fn map_while(self, predicate: P) -> MapWhile + where + Self: Sized, + P: FnMut(Self::Item) -> Option; + fn skip(self, n: usize) -> Skip + where + Self: Sized; + fn take(self, n: usize) -> Take + where + Self: Sized; + fn scan(self, initial_state: St, f: F) -> Scan + where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option; + fn flat_map(self, f: F) -> FlatMap + where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U; + fn flatten(self) -> Flatten + where + Self: Sized, + Self::Item: IntoIterator; + fn fuse(self) -> Fuse + where + Self: Sized; + fn inspect(self, f: F) -> Inspect + where + Self: Sized, + F: FnMut(&Self::Item); + fn by_ref(&mut self) -> &mut Self + where + Self: Sized; + fn collect>(self) -> B + where + Self: Sized; + fn collect_into>(self, collection: &mut E) -> &mut E + where + Self: Sized; + fn partition(self, f: F) -> (B, B) + where + Self: Sized, + B: Default + Extend, + F: FnMut(&Self::Item) -> bool; + fn partition_in_place<'a, T: 'a, P>(mut self, predicate: P) -> usize + where + Self: Sized + DoubleEndedIterator, + P: FnMut(&T) -> bool; + fn is_partitioned

(mut self, mut predicate: P) -> bool + where + Self: Sized, + P: FnMut(Self::Item) -> bool; + fn fold(mut self, init: B, mut f: F) -> B + where + Self: Sized, + F: FnMut(B, Self::Item) -> B; + fn reduce(mut self, f: F) -> Option + where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item; + fn all(&mut self, f: F) -> bool + where + Self: Sized, + F: FnMut(Self::Item) -> bool; + fn any(&mut self, f: F) -> bool + where + Self: Sized, + F: FnMut(Self::Item) -> bool; + fn find

(&mut self, predicate: P) -> Option + where + Self: Sized, + P: FnMut(&Self::Item) -> bool; + fn find_map(&mut self, f: F) -> Option + where + Self: Sized, + F: FnMut(Self::Item) -> Option; + fn position

(&mut self, predicate: P) -> Option + where + Self: Sized, + P: FnMut(Self::Item) -> bool; + /// We will scroll to "string" to ensure it scrolls as expected. + fn this_is_a_method_with_a_long_name_returning_something() -> String; + } + + /// This one doesn't have hidden items (because there are too many) so we can also confirm that it + /// scrolls as expected. + pub trait TraitWithLongItemsName { + fn this_is_a_method_with_a_long_name_returning_something() -> String; + } +} -- cgit 1.4.1-3-g733a5