mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Update test cases for intra-doc links in summaries
This commit is contained in:
parent
20915d471a
commit
f67585d494
@ -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");
|
||||
|
@ -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.' },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user