Skip to content

Commit 3ad595a

Browse files
Add tests for invalid files generation
1 parent db95734 commit 3ad595a

5 files changed

+81
-4
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#![crate_name="foo"]
2+
3+
// @!has "foo/struct.Foo.html"
4+
#[doc(hidden)]
5+
pub struct Foo;
6+
7+
// @!has "foo/struct.Bar.html"
8+
pub use crate::Foo as Bar;
9+
10+
// @!has "foo/struct.Baz.html"
11+
#[doc(hidden)]
12+
pub use crate::Foo as Baz;
13+
14+
// @!has "foo/foo/index.html"
15+
#[doc(hidden)]
16+
pub mod foo {}
17+
18+
// @!has "foo/bar/index.html"
19+
pub use crate::foo as bar;
20+
21+
// @!has "foo/baz/index.html"
22+
#[doc(hidden)]
23+
pub use crate::foo as baz;
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![crate_name="foo"]
2+
3+
// @!has "foo/priv/index.html"
4+
// @!has "foo/priv/struct.Foo.html"
5+
mod private {
6+
pub struct Foo;
7+
}
8+
9+
// @has "foo/struct.Bar.html"
10+
pub use crate::private::Foo as Bar;
11+
12+
// @!has "foo/foo/index.html"
13+
mod foo {
14+
pub mod subfoo {}
15+
}
16+
17+
// @has "foo/bar/index.html"
18+
pub use crate::foo::subfoo as bar;

tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
#![crate_name = "foo"]
44

55
// @!has 'foo/hidden/index.html'
6-
// FIXME: add missing `@` for the two next tests once issue is fixed!
7-
// To be done in <https://github.com/rust-lang/rust/issues/111249>.
8-
// !has 'foo/hidden/inner/index.html'
9-
// !has 'foo/hidden/inner/trait.Foo.html'
6+
// @!has 'foo/hidden/inner/index.html'
7+
// FIXME: Should be `@!has`: https://github.com/rust-lang/rust/issues/111249
8+
// @has 'foo/hidden/inner/trait.Foo.html'
9+
// @matchesraw - '<meta http-equiv="refresh" content="0;URL=../../../foo/visible/trait.Foo.html">'
1010
#[doc(hidden)]
1111
pub mod hidden {
1212
pub mod inner {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#![crate_name = "foo"]
2+
#![feature(no_core)]
3+
#![no_core]
4+
5+
// The following five should not fail!
6+
// @!has 'foo/hidden/index.html'
7+
// @!has 'foo/hidden/inner/index.html'
8+
// FIXME: Should be `@!has`: https://github.com/rust-lang/rust/issues/111249
9+
// @has 'foo/hidden/inner/trait.Foo.html'
10+
// @matchesraw - '<meta http-equiv="refresh" content="0;URL=../../../foo/visible/trait.Foo.html">'
11+
// @!has 'foo/hidden/inner/inner_hidden/index.html'
12+
// @!has 'foo/hidden/inner/inner_hidden/trait.HiddenFoo.html'
13+
#[doc(hidden)]
14+
pub mod hidden {
15+
pub mod inner {
16+
pub trait Foo {}
17+
18+
#[doc(hidden)]
19+
pub mod inner_hidden {
20+
pub trait HiddenFoo {}
21+
}
22+
}
23+
}
24+
25+
// @has 'foo/visible/index.html'
26+
// @has 'foo/visible/trait.Foo.html'
27+
#[doc(inline)]
28+
pub use hidden::inner as visible;
29+
30+
// @has 'foo/struct.Bar.html'
31+
// @count - '//*[@id="impl-Foo-for-Bar"]' 1
32+
pub struct Bar;
33+
34+
impl visible::Foo for Bar {}

tests/rustdoc/redirect.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ pub trait Foo {}
1010
// @has - '//code' 'pub use reexp_stripped::Bar'
1111
// @has - '//code/a' 'Bar'
1212
// @has - '//a[@href="../reexp_stripped/hidden/struct.Bar.html"]' 'Bar'
13+
// FIXME: Should be `@!has`: https://github.com/rust-lang/rust/issues/111249
1314
// @has reexp_stripped/hidden/struct.Bar.html
15+
// @matchesraw - '<meta http-equiv="refresh" content="0;URL=../../reexp_stripped/struct.Bar.html">'
1416
// @has 'reexp_stripped/struct.Bar.html'
1517
// @has - '//a[@href="struct.Bar.html"]' 'Bar'
1618
#[doc(no_inline)]

0 commit comments

Comments
 (0)