Update tests

This commit is contained in:
Manish Goregaokar 2016-05-19 00:07:58 +05:30
parent 74633b08e0
commit 9ce018bafb
No known key found for this signature in database
GPG key ID: 3BBF4D3E2EF79F98
2 changed files with 36 additions and 21 deletions

View file

@ -1660,7 +1660,8 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re
fn document_short(w: &mut fmt::Formatter, item: &clean::Item, link: AssocItemLink) -> fmt::Result {
if let Some(s) = item.doc_value() {
let markdown = if s.contains('\n') {
format!("{} [Read more]({})", &plain_summary_line(Some(s)), naive_assoc_href(item, link))
format!("{} [Read more]({})",
&plain_summary_line(Some(s)), naive_assoc_href(item, link))
} else {
format!("{}", &plain_summary_line(Some(s)))
};
@ -2619,25 +2620,26 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
_ => panic!("can't make docs for trait item with name {:?}", item.name)
}
if !is_default_item && (!is_static || render_static) {
if !is_static || render_static {
if !is_default_item {
if item.doc_value().is_some() {
document(w, cx, item)
} else {
// In case the item isn't documented,
// provide short documentation from the trait
if let Some(t) = trait_ {
if let Some(it) = t.items.iter()
.find(|i| i.name == item.name) {
document_short(w, it, link)?;
if item.doc_value().is_some() {
document(w, cx, item)?;
} else {
// In case the item isn't documented,
// provide short documentation from the trait
if let Some(t) = trait_ {
if let Some(it) = t.items.iter()
.find(|i| i.name == item.name) {
document_short(w, it, link)?;
}
}
}
Ok(())
} else {
document_short(w, item, link)?;
}
} else {
document_short(w, item, link)?;
Ok(())
}
Ok(())
}
let traits = &cache().traits;

View file

@ -21,13 +21,24 @@ pub trait T {
fn b_method(&self) -> usize {
self.a_method()
}
/// Docs associated with the trait c_method definition.
///
/// There is another line
fn c_method(&self) -> usize {
self.a_method()
}
}
// @has manual_impl/struct.S1.html '//*[@class="trait"]' 'T'
// @has - '//*[@class="docblock"]' 'Docs associated with the S1 trait implementation.'
// @has - '//*[@class="docblock"]' 'Docs associated with the S1 trait a_method implementation.'
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
// @has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
// @!has - '//*[@class="docblock"]' 'There is another line'
// @has - '//*[@class="docblock"]' 'Read more'
pub struct S1(usize);
/// Docs associated with the S1 trait implementation.
@ -41,9 +52,11 @@ impl T for S1 {
// @has manual_impl/struct.S2.html '//*[@class="trait"]' 'T'
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait implementation.'
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait a_method implementation.'
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait b_method implementation.'
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait c_method implementation.'
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
// @!has - '//*[@class="docblock"]' 'Read more'
pub struct S2(usize);
/// Docs associated with the S2 trait implementation.
@ -53,8 +66,8 @@ impl T for S2 {
self.0
}
/// Docs associated with the S2 trait b_method implementation.
fn b_method(&self) -> usize {
/// Docs associated with the S2 trait c_method implementation.
fn c_method(&self) -> usize {
5
}
}
@ -62,7 +75,7 @@ impl T for S2 {
// @has manual_impl/struct.S3.html '//*[@class="trait"]' 'T'
// @has - '//*[@class="docblock"]' 'Docs associated with the S3 trait implementation.'
// @has - '//*[@class="docblock"]' 'Docs associated with the S3 trait b_method implementation.'
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
// @has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
pub struct S3(usize);
/// Docs associated with the S3 trait implementation.