Skip to content

Commit

Permalink
Update test cases for intra-doc links in summaries
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Jun 19, 2021
1 parent 20915d4 commit f67585d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/librustdoc/html/markdown/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-js/summaries.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.' },
],
},
{
Expand Down
6 changes: 4 additions & 2 deletions src/test/rustdoc-js/summaries.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit f67585d

Please sign in to comment.