Skip to content

Commit

Permalink
Add test for typedef deref
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 15, 2020
1 parent 12f029b commit fd4a88f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/rustdoc/deref-typedef.rs
@@ -0,0 +1,19 @@
#![crate_name = "foo"]

// @has 'foo/struct.Bar.html'
// @has '-' '//*[@id="deref-methods"]' 'Methods from Deref<Target = FooB>'
// @has '-' '//*[@class="impl-items"]//*[@id="method.happy"]' 'pub fn happy(&self)'
// @has '-' '//*[@class="sidebar-title"]' 'Methods from Deref<Target=FooB>'
// @has '-' '//*[@class="sidebar-links"]/a[@href="#method.happy"]' 'happy'
pub struct FooA;
pub type FooB = FooA;

impl FooA {
pub fn happy(&self) {}
}

pub struct Bar;
impl std::ops::Deref for Bar {
type Target = FooB;
fn deref(&self) -> &FooB { unimplemented!() }
}

0 comments on commit fd4a88f

Please sign in to comment.