Skip to content

Commit e7bc2a0

Browse files
Add tests for reexports (both public and private)
1 parent cc09326 commit e7bc2a0

File tree

5 files changed

+137
-14
lines changed

5 files changed

+137
-14
lines changed

src/test/rustdoc/auxiliary/macro-2-reexport.rs

-6
This file was deleted.
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#![feature(decl_macro)]
2+
3+
pub macro addr_of($place:expr) {
4+
&raw const $place
5+
}
6+
7+
pub macro addr_of_self($place:expr) {
8+
&raw const $place
9+
}
10+
11+
pub macro addr_of_crate($place:expr) {
12+
&raw const $place
13+
}
14+
15+
pub struct Foo;
16+
pub struct FooSelf;
17+
pub struct FooCrate;
18+
19+
pub enum Bar { Foo, }
20+
pub enum BarSelf { Foo, }
21+
pub enum BarCrate { Foo, }
22+
23+
pub fn foo() {}
24+
pub fn foo_self() {}
25+
pub fn foo_crate() {}
26+
27+
pub type Type = i32;
28+
pub type TypeSelf = i32;
29+
pub type TypeCrate = i32;
30+
31+
pub union Union {
32+
a: i8,
33+
b: i8,
34+
}
35+
pub union UnionSelf {
36+
a: i8,
37+
b: i8,
38+
}
39+
pub union UnionCrate {
40+
a: i8,
41+
b: i8,
42+
}

src/test/rustdoc/macro-2-reexport.rs

-8
This file was deleted.

src/test/rustdoc/reexports-priv.rs

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// aux-build: reexports.rs
2+
// compile-flags: --document-private-items
3+
4+
#![crate_name = "foo"]
5+
6+
extern crate reexports;
7+
8+
// @has 'foo/macro.addr_of.html' '//*[@class="docblock type-decl"]' 'pub macro addr_of($place : expr) {'
9+
pub use reexports::addr_of;
10+
// @has 'foo/macro.addr_of_crate.html' '//*[@class="docblock type-decl"]' 'pub(crate) macro addr_of_crate($place : expr) {'
11+
pub(crate) use reexports::addr_of_crate;
12+
// @has 'foo/macro.addr_of_self.html' '//*[@class="docblock type-decl"]' 'pub(crate) macro addr_of_self($place : expr) {'
13+
pub(self) use reexports::addr_of_self;
14+
15+
// @has 'foo/struct.Foo.html' '//*[@class="docblock type-decl"]' 'pub struct Foo;'
16+
pub use reexports::Foo;
17+
// @has 'foo/struct.FooCrate.html' '//*[@class="docblock type-decl"]' 'pub(crate) struct FooCrate;'
18+
pub(crate) use reexports::FooCrate;
19+
// @has 'foo/struct.FooSelf.html' '//*[@class="docblock type-decl"]' 'pub(crate) struct FooSelf;'
20+
pub(self) use reexports::FooSelf;
21+
22+
// @has 'foo/enum.Bar.html' '//*[@class="docblock type-decl"]' 'pub enum Bar {'
23+
pub use reexports::Bar;
24+
// @has 'foo/enum.BarCrate.html' '//*[@class="docblock type-decl"]' 'pub(crate) enum BarCrate {'
25+
pub(crate) use reexports::BarCrate;
26+
// @has 'foo/enum.BarSelf.html' '//*[@class="docblock type-decl"]' 'pub(crate) enum BarSelf {'
27+
pub(self) use reexports::BarSelf;
28+
29+
// @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()'
30+
pub use reexports::foo;
31+
// @has 'foo/fn.foo_crate.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_crate()'
32+
pub(crate) use reexports::foo_crate;
33+
// @has 'foo/fn.foo_self.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_self()'
34+
pub(self) use reexports::foo_self;
35+
36+
// @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type ='
37+
pub use reexports::Type;
38+
// @has 'foo/type.TypeCrate.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeCrate ='
39+
pub(crate) use reexports::TypeCrate;
40+
// @has 'foo/type.TypeSelf.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeSelf ='
41+
pub(self) use reexports::TypeSelf;
42+
43+
// @has 'foo/union.Union.html' '//*[@class="docblock type-decl"]' 'pub union Union {'
44+
pub use reexports::Union;
45+
// @has 'foo/union.UnionCrate.html' '//*[@class="docblock type-decl"]' 'pub(crate) union UnionCrate {'
46+
pub(crate) use reexports::UnionCrate;
47+
// @has 'foo/union.UnionSelf.html' '//*[@class="docblock type-decl"]' 'pub(crate) union UnionSelf {'
48+
pub(self) use reexports::UnionSelf;

src/test/rustdoc/reexports.rs

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// aux-build: reexports.rs
2+
3+
#![crate_name = "foo"]
4+
5+
extern crate reexports;
6+
7+
// @has 'foo/macro.addr_of.html' '//*[@class="docblock type-decl"]' 'pub macro addr_of($place : expr) {'
8+
pub use reexports::addr_of;
9+
// @!has 'foo/macro.addr_of_crate.html'
10+
pub(crate) use reexports::addr_of_crate;
11+
// @!has 'foo/macro.addr_of_self.html'
12+
pub(self) use reexports::addr_of_self;
13+
14+
// @has 'foo/struct.Foo.html' '//*[@class="docblock type-decl"]' 'pub struct Foo;'
15+
pub use reexports::Foo;
16+
// @!has 'foo/struct.FooCrate.html'
17+
pub(crate) use reexports::FooCrate;
18+
// @!has 'foo/struct.FooSelf.html'
19+
pub(self) use reexports::FooSelf;
20+
21+
// @has 'foo/enum.Bar.html' '//*[@class="docblock type-decl"]' 'pub enum Bar {'
22+
pub use reexports::Bar;
23+
// @!has 'foo/enum.BarCrate.html'
24+
pub(crate) use reexports::BarCrate;
25+
// @!has 'foo/enum.BarSelf.html'
26+
pub(self) use reexports::BarSelf;
27+
28+
// @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()'
29+
pub use reexports::foo;
30+
// @!has 'foo/fn.foo_crate.html'
31+
pub(crate) use reexports::foo_crate;
32+
// @!has 'foo/fn.foo_self.html'
33+
pub(self) use reexports::foo_self;
34+
35+
// @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type ='
36+
pub use reexports::Type;
37+
// @!has 'foo/type.TypeCrate.html'
38+
pub(crate) use reexports::TypeCrate;
39+
// @!has 'foo/type.TypeSelf.html'
40+
pub(self) use reexports::TypeSelf;
41+
42+
// @has 'foo/union.Union.html' '//*[@class="docblock type-decl"]' 'pub union Union {'
43+
pub use reexports::Union;
44+
// @!has 'foo/union.UnionCrate.html'
45+
pub(crate) use reexports::UnionCrate;
46+
// @!has 'foo/union.UnionSelf.html'
47+
pub(self) use reexports::UnionSelf;

0 commit comments

Comments
 (0)