Add tests for reexports (both public and private)

This commit is contained in:
Guillaume Gomez 2021-07-06 15:19:02 +02:00
parent cc0932641a
commit e7bc2a012a
5 changed files with 137 additions and 14 deletions

View File

@ -1,6 +0,0 @@
#![crate_name = "macro_2_reexport"]
#![feature(decl_macro)]
pub macro addr_of($place:expr) {
&raw const $place
}

View File

@ -0,0 +1,42 @@
#![feature(decl_macro)]
pub macro addr_of($place:expr) {
&raw const $place
}
pub macro addr_of_self($place:expr) {
&raw const $place
}
pub macro addr_of_crate($place:expr) {
&raw const $place
}
pub struct Foo;
pub struct FooSelf;
pub struct FooCrate;
pub enum Bar { Foo, }
pub enum BarSelf { Foo, }
pub enum BarCrate { Foo, }
pub fn foo() {}
pub fn foo_self() {}
pub fn foo_crate() {}
pub type Type = i32;
pub type TypeSelf = i32;
pub type TypeCrate = i32;
pub union Union {
a: i8,
b: i8,
}
pub union UnionSelf {
a: i8,
b: i8,
}
pub union UnionCrate {
a: i8,
b: i8,
}

View File

@ -1,8 +0,0 @@
// aux-build: macro-2-reexport.rs
#![crate_name = "foo"]
extern crate macro_2_reexport;
// @has 'foo/macro.addr_of.html' '//*[@class="docblock type-decl"]' 'macro addr_of($place : expr) {'
pub use macro_2_reexport::addr_of;

View File

@ -0,0 +1,48 @@
// aux-build: reexports.rs
// compile-flags: --document-private-items
#![crate_name = "foo"]
extern crate reexports;
// @has 'foo/macro.addr_of.html' '//*[@class="docblock type-decl"]' 'pub macro addr_of($place : expr) {'
pub use reexports::addr_of;
// @has 'foo/macro.addr_of_crate.html' '//*[@class="docblock type-decl"]' 'pub(crate) macro addr_of_crate($place : expr) {'
pub(crate) use reexports::addr_of_crate;
// @has 'foo/macro.addr_of_self.html' '//*[@class="docblock type-decl"]' 'pub(crate) macro addr_of_self($place : expr) {'
pub(self) use reexports::addr_of_self;
// @has 'foo/struct.Foo.html' '//*[@class="docblock type-decl"]' 'pub struct Foo;'
pub use reexports::Foo;
// @has 'foo/struct.FooCrate.html' '//*[@class="docblock type-decl"]' 'pub(crate) struct FooCrate;'
pub(crate) use reexports::FooCrate;
// @has 'foo/struct.FooSelf.html' '//*[@class="docblock type-decl"]' 'pub(crate) struct FooSelf;'
pub(self) use reexports::FooSelf;
// @has 'foo/enum.Bar.html' '//*[@class="docblock type-decl"]' 'pub enum Bar {'
pub use reexports::Bar;
// @has 'foo/enum.BarCrate.html' '//*[@class="docblock type-decl"]' 'pub(crate) enum BarCrate {'
pub(crate) use reexports::BarCrate;
// @has 'foo/enum.BarSelf.html' '//*[@class="docblock type-decl"]' 'pub(crate) enum BarSelf {'
pub(self) use reexports::BarSelf;
// @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()'
pub use reexports::foo;
// @has 'foo/fn.foo_crate.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_crate()'
pub(crate) use reexports::foo_crate;
// @has 'foo/fn.foo_self.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_self()'
pub(self) use reexports::foo_self;
// @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type ='
pub use reexports::Type;
// @has 'foo/type.TypeCrate.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeCrate ='
pub(crate) use reexports::TypeCrate;
// @has 'foo/type.TypeSelf.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeSelf ='
pub(self) use reexports::TypeSelf;
// @has 'foo/union.Union.html' '//*[@class="docblock type-decl"]' 'pub union Union {'
pub use reexports::Union;
// @has 'foo/union.UnionCrate.html' '//*[@class="docblock type-decl"]' 'pub(crate) union UnionCrate {'
pub(crate) use reexports::UnionCrate;
// @has 'foo/union.UnionSelf.html' '//*[@class="docblock type-decl"]' 'pub(crate) union UnionSelf {'
pub(self) use reexports::UnionSelf;

View File

@ -0,0 +1,47 @@
// aux-build: reexports.rs
#![crate_name = "foo"]
extern crate reexports;
// @has 'foo/macro.addr_of.html' '//*[@class="docblock type-decl"]' 'pub macro addr_of($place : expr) {'
pub use reexports::addr_of;
// @!has 'foo/macro.addr_of_crate.html'
pub(crate) use reexports::addr_of_crate;
// @!has 'foo/macro.addr_of_self.html'
pub(self) use reexports::addr_of_self;
// @has 'foo/struct.Foo.html' '//*[@class="docblock type-decl"]' 'pub struct Foo;'
pub use reexports::Foo;
// @!has 'foo/struct.FooCrate.html'
pub(crate) use reexports::FooCrate;
// @!has 'foo/struct.FooSelf.html'
pub(self) use reexports::FooSelf;
// @has 'foo/enum.Bar.html' '//*[@class="docblock type-decl"]' 'pub enum Bar {'
pub use reexports::Bar;
// @!has 'foo/enum.BarCrate.html'
pub(crate) use reexports::BarCrate;
// @!has 'foo/enum.BarSelf.html'
pub(self) use reexports::BarSelf;
// @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()'
pub use reexports::foo;
// @!has 'foo/fn.foo_crate.html'
pub(crate) use reexports::foo_crate;
// @!has 'foo/fn.foo_self.html'
pub(self) use reexports::foo_self;
// @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type ='
pub use reexports::Type;
// @!has 'foo/type.TypeCrate.html'
pub(crate) use reexports::TypeCrate;
// @!has 'foo/type.TypeSelf.html'
pub(self) use reexports::TypeSelf;
// @has 'foo/union.Union.html' '//*[@class="docblock type-decl"]' 'pub union Union {'
pub use reexports::Union;
// @!has 'foo/union.UnionCrate.html'
pub(crate) use reexports::UnionCrate;
// @!has 'foo/union.UnionSelf.html'
pub(self) use reexports::UnionSelf;