Update test cases for intra-doc links in summaries

This commit is contained in:
Michael Howell 2021-06-18 17:47:05 -07:00
parent 20915d471a
commit f67585d494
3 changed files with 8 additions and 4 deletions

View File

@ -221,7 +221,7 @@ fn test_header_ids_multiple_blocks() {
#[test]
fn test_short_markdown_summary() {
fn t(input: &str, expect: &str) {
let output = short_markdown_summary(input);
let output = short_markdown_summary(input, &[][..]);
assert_eq!(output, expect, "original: {}", input);
}
@ -232,6 +232,7 @@ fn test_short_markdown_summary() {
t("Hard-break \nsummary", "Hard-break summary");
t("hello [Rust] :)\n\n[Rust]: https://www.rust-lang.org", "hello Rust :)");
t("hello [Rust](https://www.rust-lang.org \"Rust\") :)", "hello Rust :)");
t("dud [link]", "dud [link]");
t("code `let x = i32;` ...", "code <code>let x = i32;</code> …");
t("type `Type<'static>` ...", "type <code>Type<'static></code> …");
t("# top header", "top header");
@ -259,6 +260,7 @@ fn test_plain_text_summary() {
t("Hard-break \nsummary", "Hard-break summary");
t("hello [Rust] :)\n\n[Rust]: https://www.rust-lang.org", "hello Rust :)");
t("hello [Rust](https://www.rust-lang.org \"Rust\") :)", "hello Rust :)");
t("dud [link]", "dud [link]");
t("code `let x = i32;` ...", "code `let x = i32;` …");
t("type `Type<'static>` ...", "type `Type<'static>` …");
t("# top header", "top header");

View File

@ -5,7 +5,7 @@ const QUERY = ['summaries', 'summaries::Sidebar', 'summaries::Sidebar2'];
const EXPECTED = [
{
'others': [
{ 'path': '', 'name': 'summaries', 'desc': 'This <em>summary</em> has a link and <code>code</code>.' },
{ 'path': '', 'name': 'summaries', 'desc': 'This <em>summary</em> has a link, [<code>code</code>], and <code>Sidebar2</code> intra-doc.' },
],
},
{

View File

@ -1,9 +1,11 @@
#![crate_type = "lib"]
#![crate_name = "summaries"]
//! This *summary* has a [link] and `code`.
//! This *summary* has a [link], [`code`], and [`Sidebar2`] intra-doc.
//!
//! This is the second paragraph.
//! This is the second paragraph. It should not be rendered.
//! To test that intra-doc links are resolved properly, [`code`] should render
//! the square brackets, and [`Sidebar2`] should not.
//!
//! [link]: https://example.com