about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc/alias-reexport.rs16
-rw-r--r--tests/rustdoc/alias-reexport2.rs16
-rw-r--r--tests/rustdoc/auxiliary/alias-reexport.rs3
-rw-r--r--tests/rustdoc/auxiliary/alias-reexport2.rs12
-rw-r--r--tests/rustdoc/files-creation-hidden.rs23
-rw-r--r--tests/rustdoc/files-creation-private.rs18
-rw-r--r--tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs8
-rw-r--r--tests/rustdoc/issue-111249-file-creation.rs34
-rw-r--r--tests/rustdoc/redirect.rs2
9 files changed, 128 insertions, 4 deletions
diff --git a/tests/rustdoc/alias-reexport.rs b/tests/rustdoc/alias-reexport.rs
new file mode 100644
index 00000000000..a2a8e651caf
--- /dev/null
+++ b/tests/rustdoc/alias-reexport.rs
@@ -0,0 +1,16 @@
+// aux-build:alias-reexport.rs
+// aux-build:alias-reexport2.rs
+
+#![crate_name = "foo"]
+#![feature(lazy_type_alias)]
+
+extern crate alias_reexport2;
+
+// @has 'foo/reexport/fn.foo.html'
+// @has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported'
+// @has 'foo/reexport/fn.foo2.html'
+// @has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
+// @has 'foo/reexport/type.Reexported.html'
+// @has - '//*[@class="rust item-decl"]' 'pub type Reexported = u8;'
+#[doc(inline)]
+pub use alias_reexport2 as reexport;
diff --git a/tests/rustdoc/alias-reexport2.rs b/tests/rustdoc/alias-reexport2.rs
new file mode 100644
index 00000000000..85d3cdad962
--- /dev/null
+++ b/tests/rustdoc/alias-reexport2.rs
@@ -0,0 +1,16 @@
+// gate-test-lazy_type_alias
+// aux-build:alias-reexport.rs
+
+#![crate_name = "foo"]
+#![feature(lazy_type_alias)]
+
+extern crate alias_reexport;
+
+use alias_reexport::Reexported;
+
+// @has 'foo/fn.foo.html'
+// @has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported'
+pub fn foo() -> Reexported { 0 }
+// @has 'foo/fn.foo2.html'
+// @has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
+pub fn foo2() -> Result<Reexported, ()> { Ok(0) }
diff --git a/tests/rustdoc/auxiliary/alias-reexport.rs b/tests/rustdoc/auxiliary/alias-reexport.rs
new file mode 100644
index 00000000000..14fafc02d36
--- /dev/null
+++ b/tests/rustdoc/auxiliary/alias-reexport.rs
@@ -0,0 +1,3 @@
+#![feature(lazy_type_alias)]
+
+pub type Reexported = u8;
diff --git a/tests/rustdoc/auxiliary/alias-reexport2.rs b/tests/rustdoc/auxiliary/alias-reexport2.rs
new file mode 100644
index 00000000000..9f6910572ad
--- /dev/null
+++ b/tests/rustdoc/auxiliary/alias-reexport2.rs
@@ -0,0 +1,12 @@
+#![feature(lazy_type_alias)]
+
+extern crate alias_reexport;
+
+pub use alias_reexport::Reexported;
+
+// @has 'foo/fn.foo.html'
+// @has - '//*[@class="docblock item-decl"]' 'pub fn foo() -> Reexported'
+pub fn foo() -> Reexported { 0 }
+// @has 'foo/fn.foo2.html'
+// @has - '//*[@class="docblock item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
+pub fn foo2() -> Result<Reexported, ()> { Ok(0) }
diff --git a/tests/rustdoc/files-creation-hidden.rs b/tests/rustdoc/files-creation-hidden.rs
new file mode 100644
index 00000000000..bcabbfc91e8
--- /dev/null
+++ b/tests/rustdoc/files-creation-hidden.rs
@@ -0,0 +1,23 @@
+#![crate_name="foo"]
+
+// @!has "foo/struct.Foo.html"
+#[doc(hidden)]
+pub struct Foo;
+
+// @!has "foo/struct.Bar.html"
+pub use crate::Foo as Bar;
+
+// @!has "foo/struct.Baz.html"
+#[doc(hidden)]
+pub use crate::Foo as Baz;
+
+// @!has "foo/foo/index.html"
+#[doc(hidden)]
+pub mod foo {}
+
+// @!has "foo/bar/index.html"
+pub use crate::foo as bar;
+
+// @!has "foo/baz/index.html"
+#[doc(hidden)]
+pub use crate::foo as baz;
diff --git a/tests/rustdoc/files-creation-private.rs b/tests/rustdoc/files-creation-private.rs
new file mode 100644
index 00000000000..ca2327e0f91
--- /dev/null
+++ b/tests/rustdoc/files-creation-private.rs
@@ -0,0 +1,18 @@
+#![crate_name="foo"]
+
+// @!has "foo/priv/index.html"
+// @!has "foo/priv/struct.Foo.html"
+mod private {
+    pub struct Foo;
+}
+
+// @has "foo/struct.Bar.html"
+pub use crate::private::Foo as Bar;
+
+// @!has "foo/foo/index.html"
+mod foo {
+    pub mod subfoo {}
+}
+
+// @has "foo/bar/index.html"
+pub use crate::foo::subfoo as bar;
diff --git a/tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs b/tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs
index 8e1029a1ca3..d6832bb7a09 100644
--- a/tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs
+++ b/tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs
@@ -3,10 +3,10 @@
 #![crate_name = "foo"]
 
 // @!has 'foo/hidden/index.html'
-// FIXME: add missing `@` for the two next tests once issue is fixed!
-// To be done in <https://github.com/rust-lang/rust/issues/111249>.
-// !has 'foo/hidden/inner/index.html'
-// !has 'foo/hidden/inner/trait.Foo.html'
+// @!has 'foo/hidden/inner/index.html'
+// FIXME: Should be `@!has`: https://github.com/rust-lang/rust/issues/111249
+// @has 'foo/hidden/inner/trait.Foo.html'
+// @matchesraw - '<meta http-equiv="refresh" content="0;URL=../../../foo/visible/trait.Foo.html">'
 #[doc(hidden)]
 pub mod hidden {
     pub mod inner {
diff --git a/tests/rustdoc/issue-111249-file-creation.rs b/tests/rustdoc/issue-111249-file-creation.rs
new file mode 100644
index 00000000000..d2042b231e4
--- /dev/null
+++ b/tests/rustdoc/issue-111249-file-creation.rs
@@ -0,0 +1,34 @@
+#![crate_name = "foo"]
+#![feature(no_core)]
+#![no_core]
+
+// The following five should not fail!
+// @!has 'foo/hidden/index.html'
+// @!has 'foo/hidden/inner/index.html'
+// FIXME: Should be `@!has`: https://github.com/rust-lang/rust/issues/111249
+// @has 'foo/hidden/inner/trait.Foo.html'
+// @matchesraw - '<meta http-equiv="refresh" content="0;URL=../../../foo/visible/trait.Foo.html">'
+// @!has 'foo/hidden/inner/inner_hidden/index.html'
+// @!has 'foo/hidden/inner/inner_hidden/trait.HiddenFoo.html'
+#[doc(hidden)]
+pub mod hidden {
+    pub mod inner {
+        pub trait Foo {}
+
+        #[doc(hidden)]
+        pub mod inner_hidden {
+            pub trait HiddenFoo {}
+        }
+    }
+}
+
+// @has 'foo/visible/index.html'
+// @has 'foo/visible/trait.Foo.html'
+#[doc(inline)]
+pub use hidden::inner as visible;
+
+// @has 'foo/struct.Bar.html'
+// @count - '//*[@id="impl-Foo-for-Bar"]' 1
+pub struct Bar;
+
+impl visible::Foo for Bar {}
diff --git a/tests/rustdoc/redirect.rs b/tests/rustdoc/redirect.rs
index 5b7a76e1a77..4fb81c23d39 100644
--- a/tests/rustdoc/redirect.rs
+++ b/tests/rustdoc/redirect.rs
@@ -10,7 +10,9 @@ pub trait Foo {}
 // @has - '//code' 'pub use reexp_stripped::Bar'
 // @has - '//code/a' 'Bar'
 // @has - '//a[@href="../reexp_stripped/hidden/struct.Bar.html"]' 'Bar'
+// FIXME: Should be `@!has`: https://github.com/rust-lang/rust/issues/111249
 // @has reexp_stripped/hidden/struct.Bar.html
+// @matchesraw - '<meta http-equiv="refresh" content="0;URL=../../reexp_stripped/struct.Bar.html">'
 // @has 'reexp_stripped/struct.Bar.html'
 // @has - '//a[@href="struct.Bar.html"]' 'Bar'
 #[doc(no_inline)]