Skip to content

Commit

Permalink
Add rustdoc tests for lazy_type_alias
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jun 21, 2023
1 parent 60ec840 commit 1af48be
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/rustdoc/alias-reexport.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 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'
// FIXME: should be 'pub fn foo() -> Reexport'
// @has - '//*[@class="rust item-decl"]' 'pub fn foo() -> u8'
// @has 'foo/reexport/fn.foo2.html'
// FIXME: should be 'pub fn foo2() -> Result<Reexport, ()>'
// @has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<u8, ()>'
// @has 'foo/reexport/type.Reexported.html'
// @has - '//*[@class="rust item-decl"]' 'pub type Reexported = u8;'
#[doc(inline)]
pub use alias_reexport2 as reexport;
16 changes: 16 additions & 0 deletions tests/rustdoc/alias-reexport2.rs
Original file line number Diff line number Diff line change
@@ -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) }
3 changes: 3 additions & 0 deletions tests/rustdoc/auxiliary/alias-reexport.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#![feature(lazy_type_alias)]

pub type Reexported = u8;
12 changes: 12 additions & 0 deletions tests/rustdoc/auxiliary/alias-reexport2.rs
Original file line number Diff line number Diff line change
@@ -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) }

0 comments on commit 1af48be

Please sign in to comment.