rustdoc: Format return values consistently
This commit is contained in:
@@ -533,7 +533,7 @@ fn write_return(
|
|||||||
) {
|
) {
|
||||||
alt doc.desc {
|
alt doc.desc {
|
||||||
some(d) {
|
some(d) {
|
||||||
ctxt.w.write_line(#fmt("Returns - %s", d));
|
ctxt.w.write_line(#fmt("Return value: %s", d));
|
||||||
ctxt.w.write_line("");
|
ctxt.w.write_line("");
|
||||||
}
|
}
|
||||||
none { }
|
none { }
|
||||||
@@ -544,7 +544,7 @@ fn write_return(
|
|||||||
fn should_write_return_type_on_new_line() {
|
fn should_write_return_type_on_new_line() {
|
||||||
let markdown = test::render(
|
let markdown = test::render(
|
||||||
"#[doc(return = \"test\")] fn a() -> int { }");
|
"#[doc(return = \"test\")] fn a() -> int { }");
|
||||||
assert str::contains(markdown, "\nReturns - test");
|
assert str::contains(markdown, "\nReturn value: test");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -553,13 +553,13 @@ fn should_write_blank_line_between_return_type_and_next_header() {
|
|||||||
"#[doc(return = \"test\")] fn a() -> int { } \
|
"#[doc(return = \"test\")] fn a() -> int { } \
|
||||||
fn b() -> int { }"
|
fn b() -> int { }"
|
||||||
);
|
);
|
||||||
assert str::contains(markdown, "Returns - test\n\n##");
|
assert str::contains(markdown, "Return value: test\n\n##");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_not_write_return_type_when_there_is_none() {
|
fn should_not_write_return_type_when_there_is_none() {
|
||||||
let markdown = test::render("fn a() { }");
|
let markdown = test::render("fn a() { }");
|
||||||
assert !str::contains(markdown, "Returns");
|
assert !str::contains(markdown, "Return value");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -808,7 +808,7 @@ fn should_not_write_iface_method_arguments_if_none() {
|
|||||||
fn should_write_iface_method_return_info() {
|
fn should_write_iface_method_return_info() {
|
||||||
let markdown = test::render(
|
let markdown = test::render(
|
||||||
"iface a { #[doc(return = \"test\")] fn a() -> int; }");
|
"iface a { #[doc(return = \"test\")] fn a() -> int; }");
|
||||||
assert str::contains(markdown, "Returns - test");
|
assert str::contains(markdown, "Return value: test");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -890,7 +890,7 @@ fn should_not_write_impl_method_arguments_if_none() {
|
|||||||
fn should_write_impl_method_return_info() {
|
fn should_write_impl_method_return_info() {
|
||||||
let markdown = test::render(
|
let markdown = test::render(
|
||||||
"impl a for int { #[doc(return = \"test\")] fn a() -> int { } }");
|
"impl a for int { #[doc(return = \"test\")] fn a() -> int { } }");
|
||||||
assert str::contains(markdown, "Returns - test");
|
assert str::contains(markdown, "Return value: test");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user